SqlServer错误:错误170 [英] SqlServer Error: Error 170
问题描述
我收到错误170,@ chk附近的语法不正确.
下面是存储过程.
创建Proc spCompareGrossWeight(@HouseBillId varchar(36),@ HouseBillNumber varchar(36),@ GWeight varchar(36),@ chk int输出)
如
开始
声明@weight int
声明@gwt int
SELECT @ weight = SUM(GWeight)
来自HouseBills
在哪里(ReferenceHouseBillId = @HouseBillId)
设置@gwt = GWeight
如果(@weight = @gwt)
@chk = 1
其他
@chk = 0
end
I am getting the error 170, incorrect syntax near @chk.
below is the stored procedure.
Create Proc spCompareGrossWeight(@HouseBillId varchar(36), @HouseBillNumber varchar(36), @GWeight varchar(36), @chk int output)
as
begin
declare @weight int
declare @gwt int
SELECT @weight= SUM(GWeight)
FROM HouseBills
WHERE (ReferenceHouseBillId = @HouseBillId)
set @gwt = GWeight
if (@weight = @gwt)
@chk = 1
else
@chk = 0
end
推荐答案
Set @chk = 1
代替@chk = 1
if (@weight = @gwt)
set @chk = 1
else
set @chk = 0
end
SET 参数
干杯
SET the parameter
Cheers
这篇关于SqlServer错误:错误170的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!