这么晚了有人在线么,跪求拼接字符串高手来来来!!
如题 我在页面 返回值 ret = (0000000054000010,0000000119000010);里面值是字符,不是数字,
我现在先把在ret里面的值作为sql的条件 写成ret=('0000000054000010','0000000119000010')
跪求拼接大神了 谢谢~
[解决办法]
declare @ret varchar(100),@tsql varchar(200)
select @ret='(0000000054000010,0000000119000010)'
select @tsql='select * from [表名] where ret in '
+replace(replace(replace(@ret,'(','('''),',',''','''),')',''')')
-- 打印
print @tsql
/*
select * from [表名] where ret in ('0000000054000010','0000000119000010')
*/
-- 执行
exec(@tsql)