首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

in(@参数)报错:在将nvarchar值转换成数据类型int时失败

2013-03-01 
求助:in(@参数)报错:在将nvarchar值转换成数据类型int时失败本帖最后由 daisyding1984 于 2013-02-23 10:0

求助:in(@参数)报错:在将nvarchar值转换成数据类型int时失败
本帖最后由 daisyding1984 于 2013-02-23 10:03:29 编辑 select * from GoodsAttr where AttrId = @AttrId and GoodsAttrId in (@GoodsAttrId)
报错:在将nvarchar 值 转换成数据类型 int 时失败

然后改成:
exec('select * from GoodsAttr where AttrId = @AttrId and GoodsAttrId in ('+@GoodsAttrId+')')
报错:必须声明标量变量 "AttrId"

求助改怎么写?(字段AttrId是Int类型)
[解决办法]

exec('select * from GoodsAttr where AttrId ='+ @AttrId +' and GoodsAttrId in ('+@GoodsAttrId+')')

热点排行
Bad Request.