我有一个名为" tblBoxStock
"并获取名为@newQty
的值,并希望在当前值(列名currentQty
)之上加起来。
Create proc spUpdateQty @newQty int, @boxName nvarchar(20)
as
Begin
Update tblBoxStock
set currentQty + @newQty = @newQty
where boxName = @boxName
End
行
set currentQty + @newQty = @newQty
显示错误。我该如何解决这个问题?
答案 0 :(得分:0)
应该这样做
Update tblBoxStock
set currentQty = currentQty + isnull(@newQty,0)
where boxName = @boxName
答案 1 :(得分:0)
您需要设置列值:
<input>
有些数据库允许你写:
datalist
我建议测试该值以查看是否需要更新:
Update tblBoxStock
set currentQty = currentQty + @newQty
where boxName = @boxName;