SQLCMD 执行 SQL脚本出错(手动执行没问题,SQLCMD执行报错)
如下为该脚本开始的部分。前面又执行过其他相关脚本。但跟报错的@s没有关系,就是生成了临时表##Sub_5。初学,脚本很粗糙。declare@sINTdeclare@jIN...
如下为该脚本开始的部分。前面又执行过其他相关脚本。但跟报错的@s没有关系,就是生成了临时表##Sub_5。 初学,脚本很粗糙。
declare @s INT
declare @j INTdeclare @Max INTdeclare @X varchar(250);set @s=90001set @j=1;while @s<92000 begin set @X = '%'+ 'G'+CONVERT(varchar(250),@s) + '%' select @Max=max(Ind_G) from ##Sub_5 where [index_C] like @X
报错信息为Msg 102 Level 15,state 1 Server XXXX, Line 79
incorrect syntax near '@s'
Msg 137 Level 15,state 1 Server XXXX, Line 85
Must Declare the scalar variable “@s”
Msg 137 Level 15,state 2 Server XXXX, Line 87
Must Declare the scalar variable “@s”
Msg 137 Level 15,state 2 Server XXXX, Line 89
Must Declare the scalar variable “@s”
Msg 137 Level 15,state 2 Server XXXX, Line 108
Must Declare the scalar variable “@s” 展开
declare @s INT
declare @j INTdeclare @Max INTdeclare @X varchar(250);set @s=90001set @j=1;while @s<92000 begin set @X = '%'+ 'G'+CONVERT(varchar(250),@s) + '%' select @Max=max(Ind_G) from ##Sub_5 where [index_C] like @X
报错信息为Msg 102 Level 15,state 1 Server XXXX, Line 79
incorrect syntax near '@s'
Msg 137 Level 15,state 1 Server XXXX, Line 85
Must Declare the scalar variable “@s”
Msg 137 Level 15,state 2 Server XXXX, Line 87
Must Declare the scalar variable “@s”
Msg 137 Level 15,state 2 Server XXXX, Line 89
Must Declare the scalar variable “@s”
Msg 137 Level 15,state 2 Server XXXX, Line 108
Must Declare the scalar variable “@s” 展开
1个回答
2014-01-09
展开全部
先执行set define off
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询