将 varchar 值 '0-9' 转换为数据类型为 int 的列时发生语法错误。
SELECT dbo.TOrderForm_Object.OrderForm_ID,
dbo.TOrderForm_Object.OrderForm_Object_ID
FROM dbo.TOrderForm INNER JOIN
dbo.TOrderForm_Object ON
dbo.TOrderForm.OrderForm_ID = dbo.TOrderForm_Object.OrderForm_ID INNER JOIN
dbo.TOrderForm_Detail ON
dbo.TOrderForm_Object.OrderForm_Object_ID = dbo.TOrderForm_Detail.OrderForm_Object_ID
where cast(right(TOrderForm.OrderForm_NO1,3) as int) > 45 and cast(right(TOrderForm.OrderForm_NO1,3)as int) <227
OrderForm_NO1 为 varchar(250) 值是10位 0006524520
我判断是 OrderForm_NO1 后3为转为 INT 判断
提示将 varchar 值 '0-9 ' 转换为数据类型为 int 的列时发生语法错误。
------解决方案--------------------like [0-9]这样判断
------解决方案--------------------请确认一下后三位是什么样的数据