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