SQL Server - does trigger affects @@Rowcount?

前端 未结 1 1567
说谎
说谎 2020-12-16 13:16

I have a query which do UPSERT or update if exists and insert if not:

update MyTable 
set [Name]=@NewValue 
where ID=@ID

If @@RowCount = 0 
insert into MyTa         


        
相关标签:
1条回答
  • 2020-12-16 13:50

    @@ROWCOUNT is tied to the scope of your current execution and is therefore unaffected by a trigger, which would run in a different scope.

    0 讨论(0)
提交回复
热议问题