Declare @Command Varchar(2000)
SET @[email protected]+''''
SET @PN80=replace(@PN80,',',''',''')
SET @Command='SELECT Customer,PN80,PN AS PN52,Dosage as Usage,Flow,Line,Hours,OutPutQty FROM HOURSSMT WHERE PN80 IN ([email protected]+')'
EXEC(@Command)
[email protected],也就是字符串很长,这条SQL语句就报错了,不知道有什么解决办法呢,
------解决方案--------------------
Declare @Command Varchar(8000) SET @[email protected]+''''
SET @PN80=replace(@PN80,',',''',''')
SET @Command='SELECT Customer,PN80,PN AS PN52,Dosage as Usage,Flow,Line,Hours,OutPutQty FROM HOURSSMT WHERE PN80 IN ([email protected]+')'
EXEC(@Command)
------解决方案--------------------
MSSQL2000不能那么写,的分开
@PN80 VARCHAR(MAX)
set @PN80=''
2008当中可以你那么写