@id應該是 int類型exec('select * from name where id in ('+@id+')')

解决方案 »

  1.   

    85,32 怎么可能转换为int类型呢?
      

  2.   

    改這樣declare @id varchar(1000)
    set @id='85,32'
    exec('select * from name where id in ('+@id+')')
      

  3.   

    偶觉得既然是动态的in语句,需用动态SQL,所以可以按2楼说的,
    exec('select * from name where id in ('+@id+')') ,
    其中@id为char(100)
    楼主的语句这样的语句数据库无法认别