34,593
社区成员
发帖
与我相关
我的任务
分享
select * from Operator where Username in('admin2','cai','admin','ccccccc')
-------------------------------------
declare @a varchar(500)
set select @a=[U_power] from UserGroup where U_ID='1'
begin
select * from Operator where Username in(''''+(replace(@a,',',''','''))+'''')
end
-------------------------
declare @a varchar(500)
--或者
set @a=(select [U_power] from UserGroup where U_ID='1')
begin
exec ('select * from Operator where Username in('+@a+')')
end
declare @a varchar(500)
set @a=','
select @a=@a+[U_power]+',' from UserGroup where U_ID='1'
begin
select * from Operator where patindex(','+Username+',',@a)>0
end
declare @a varchar(500)
set @a=','
select @a=@a+[U_power]+',' from UserGroup where U_ID='1'
begin
select * from Operator where @a like '%,'+Username+',%'
end
--或者
set @a=(select [U_power] from UserGroup where U_ID='1')
select @a=[U_power] from UserGroup where U_ID='1'
select * from Operator where charindex(Username ,@a) > 0