这是如果 Hit > 0 SQL 服务器应该返回 false 并更新表的场景。我的语法有问题。
Create PROCEDURE [dbo].[sp_CheckTransactionExist_TransID]
@TransID int
AS
Declare @Hits bit
Declare @Hit bigint
SET @Hit = 0
Select @Hit = @Hit + count(1) From tblBooking Where (TransID = @TransID)
Select @Hit = @Hit + count(1) From tblOrders Where (TransID = @TransID)
Select @Hit = @Hit + count(1) From tblTransaction_DP Where (TransID = @TransID)
if @Hit > 0 then
begin
@Hits = True
end
else
begin
@Hits = False
update tblTransaction set isVoid = 1 where (Transid = @TransID)
end
Select @Hits
我有这些错误:关键字 then 和 select 附近的语法不正确。