日期:2014-05-17 浏览次数:20518 次
create proc proc_SetAdminPermissions
@adminId int,
@actions varchar(4000)
as
begin
declare @userIfExists int,@sql varchar(500)
select @userIfExists=COUNT(*) from adminaction where adminid=@adminId
print @userIfExists
if(@userIfExists > 0)
begin
set @sql = 'update adminaction set actionids='+@actions +' where adminid=' +@adminId
end
else
begin
set @sql = 'insert into adminaction(adminid,actionids) values('+@adminId+','+@actions+')'
end
exec(@sql)
end
create proc proc_SetAdminPermissions
@adminId int,
@actions varchar(4000)
as
begin
declare @userIfExists int,@sql varchar(500)
select @userIfExists=COUNT(*) from adminaction where adminid=@adminId
print @userIfExists
if(@userIfExists > 0)
begin
set @sql = 'update adminaction set actionids='''+@actions +''' where adminid='+rtrim(@adminId)
end
else
begin
set @sql = 'insert into adminaction(adminid,actionids) values('''+@adminId+''','+rtrim(@actions)+')'
end
exec(@sql)
end
--actionids, adminid 字段如果不是整型,需要加引号
--拼字段串时,需要把INT转换为字符型,再相加