SQL字符串操作 staff_id in('a,b,c,d,e,f,g')用动态写就不要改了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 declare @sql nvarchar(2000) ,@strVal nvarchar(200)select @strVal ='a,b,c,d,e,f,g' select @sql =' select * from tb where staff_id in ('''+replace(@strVal,',',''',''') +''')'--print @sql/* select * from tb where staff_id in ('a','b','c','d','e','f','g')*/exec (@sql) declare @p varchar(100)set @p='a,b,c,d,e,f,g'select * from 表 where charindex(','+staff_id+',', ','+@p+',')>0 更新一个无关紧要的字段提示"不能在具有唯一索引***插入重复键的行。 用netstat -an 显示 1433端口在监听 但是telnet 127.0.0.1 1433 却提示连接失败 求助存储过程的问题 请教数据库还原出错 请教sql语句 统计代码算法查错,只要是在一年的最后一周统计就出错,其他任何时间段都没问题 两数据库间的数据自动传递! 一个很难解决的问题,有高分呀,真的。现在很着急 请高手谈谈sql server 的复制 现在有一个项目需要实现数据对接功能 两台SQL2005服务器A,B之间的复制出错 紧急求助:如何将文本导入sql特定字符串
select @strVal ='a,b,c,d,e,f,g'
select @sql =' select * from tb where staff_id in ('''+replace(@strVal,',',''',''') +''')'
--print @sql
/*
select * from tb where staff_id in ('a','b','c','d','e','f','g')
*/
exec (@sql)