Topic: set nocount on and @@ rowcount
Respected, prompt please. Why at me the option set nocount on drops @@ rowcont in the trigger in 0, it so should be?
create table a (id int, name varchar (10)) go create trigger a_update on a for update as begin set nocount on if @@ rowcount = 0 return if exists (select 1 from inserted i join deleted d on i.id = d.id and i.name <> d.name) begin raiserror (' abort update ', 16, 1) rollback transaction return end end go insert into a (id, name) values (1, ' a ') go update a set name = ' b ' where id = 1 go drop table a go
If in this example set nocount on the trigger fulfills that, differently takes off from the trigger on the first If