求一条sql语句 有一users表,结构如下id int userName nvarchar(256)有一串字符串,例如 '张三','李四',......users表中的用户名不重复,字符串里的字符串也不重复如何求只要字符串里有的用户名,users表中没有就返回提示 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 if not exists(select 1 from users where charindex(','+userName+',', ',张三,李四',)>0) print 'msg' declare @s varchar(100)set @s='''张三'',''李四'',''王五'''exec( 'if (select count(*) from users where userName in (' + @s + ')) < 1 + len(''' + @s + ''') - len(replace(''' + @s + ''','','','''')) print ''少了用户'' ') if not exists(select 1 from users where charindex(','+userName+',', ',张三,李四',)>0) print 'msg' sql作业 同样问题,100 在来! 在sql server 中一个事物可不可以控制多个sql数据库 asp.net 求SQL查询语句 数据库连接问题 做网站怎样设置SQL??? 是不是我的机器被人黑了? 如何将字段纪录的前两个字符如00替换为CD(加班中.....请高手指点) 有谁能解释一下用命名管道和用tcp/ip 的区别? 由于工作需要,将要转到Linux平台,请问那位知道有什么好的SQL Client在Linux下? 查询表中含有某个字符串的所有行 ####应该是超简单问题:如何修改字段名####
print 'msg'
set @s='''张三'',''李四'',''王五'''
exec( '
if (select count(*) from users where userName in (' + @s + ')) < 1 + len(''' + @s + ''') - len(replace(''' + @s + ''','','',''''))
print ''少了用户''
')
print 'msg'