将 varchar 值转换为数据类型为 int 的列时发生语法错误?
我的语句如下: 
 declare   @id   int   --传过来的文章的ID号 
 Set   @id=1   
 DECLARE   @TEXT   VARCHAR(100)   --发文单位字符串 
 Set   @text= ' '   
 select   @text=@text+ '    '+articledepart   from   law_articledepart   where   ID   IN(select   articledepart   from   law_context   where   id=@id) 
 print   @text   
 /*说明:在law_context表中有一个articledepart字段,它里边存放的是发这篇文章的单位,可以有多个,以 "1,2,3 "这样的形式存放.这里的 "1,2,3 "分别对应articledepart表中的ID号.*/ 
 例如: 
 1> law_context表有一条记录 
       ID      articledepart 
          1            1,2,3 
 2> articledepart表对应的是 
       ID      articledepart 
       1               总经理室 
       2               办公室 
       3               技术部 
 我想得到的是@TEXT=   总经理室   办公室   技术部 
 用来直接输出显示! 
 但是现在用我写的语句,出错了, 
 提示: "将   varchar   值    '48,1 '   转换为数据类型为   int   的列时发生语法错误 " 
 不知道要如何写!请大家指点一下! 
------解决方案--------------------select @text=@text+ '  '+articledepart from law_articledepart where cast(ID as varchar) IN(select articledepart from law_context where id=@id) 
 print @text
------解决方案----------------------try 
 select @text=@text+ '  '+articledepart from law_articledepart  
 where charindex(rtrim(ID), (select  top 1 articledepart from law_context where id=@id))> 0 
------解决方案--------------------用Exec写写看吧