当前位置: 代码迷 >> Sql Server >> 这个变量如何才能让他正确?多谢
  详细解决方案

这个变量如何才能让他正确?多谢

热度:11   发布时间:2016-04-27 15:56:49.0
这个变量怎么才能让他正确?谢谢
select   *   from   t1   where   id   in   (1,2)
现在我想把1,2变成参数
declare   @a   varchar(500)
set   @a= '1,2 '
select   *   from   t1   where   id   in   (@a)
怎么才能改正确?谢谢

------解决方案--------------------
declare @a varchar(500)
set @a= '1,2 '
exec( 'select * from t1 where id in ( '[email protected]+ ') ')
  相关解决方案