消息 245,级别 16,状态 1,第 1 行
在将 varchar 值 ‘813,1160,1219,1227,1232’ 转换成数据类型 int 时失败。
其实此条语句在执行时,
select * from twgoldsell where ID in (@twgoldsellID)
执行的语句是:select * from twgoldsell where ID in (‘813,1160,1219,1227,1232’)
这样执行当然出错,因为@twgoldsellID是一个字符串,现在是以参数的形式传递。
解决办法:
select * from twgoldsell where ID in (@twgoldsellID)
改为:
exec(‘select * from twgoldsell where ID in (’+@twgoldsellID+‘)’)
记住:一定要加exec执行函数,不然会报如下错误:
消息 245,级别 16,状态 1,过程 Web_gettwtwgoldgameserverGoldSell,第 8 行
在将 varchar 值 ‘+@twgoldsellID+’ 转换成数据类型 int 时失败。