关于SQL语句中使用变量的问题!
declare @orderType Nvarchar(20)
set @orderType = '0,1'
Select * from Orders where OrderType In (@orderType) Order By Id Desc
其中OrderType列的类型为Int
运行提示错误:
服务器: 消息 245,级别 16,状态 1,行 3
将 nvarchar 值 '0,1' 转换为数据类型为 int 的列时发生语法错误。
想请教一下有什么处理办法?