当前位置: 代码迷 >> Sql Server >> SQL2000 参数太长了,该如何解决
  详细解决方案

SQL2000 参数太长了,该如何解决

热度:80   发布时间:2016-04-27 13:40:54.0
SQL2000 参数太长了
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当中可以你那么写
探讨

引用:
给他设为varchar(max)试试,不够的话就换类型


引用:
Declare @Command Varchar(2000)
SET @[email protected]+''''
SET @PN80=replace(@PN80,',',''',''')
SET @Command='SELECT Cu……
  相关解决方案