July 30, 2014 at 2:36 pm
I have an address table and a log table that stores historical records.
So the address table have an after update trigger whenever there is an update, the trigger will record the older records in the historyaddress table.
So the trigger is an after update trigger.
when I run a test for update a record,
it shows in manangement studio two lines of below:
...rows were affected.
... rows were affected
My first question is: I know they mean one for table ,one for the trigger. What is order then?
does the first line mean the address table rows affected?
and the second one means the records in to the historyaddress table? or vise versa?
Thanks
July 30, 2014 at 2:43 pm
First suggestion is to set NOCOUNT ON to eliminate the unnecessary network traffic.
The message can be from a select / update / insert / delete within the code, even "select 1" will return "(1 row(s) affected)".
😎
July 30, 2014 at 2:54 pm
Thanks, I will add set nocount on.
but does the first statement line of rows affected means the address table. Not the history table?
Thanks
July 30, 2014 at 2:57 pm
That is a fair guess as the after trigger execution is appended to the insert statement in the execution plan.
😎
July 30, 2014 at 3:06 pm
thanks, so I guess the first should be the original table it is updated.
and the secondline of rows affected should be always mean the rows affected in the log table.
July 30, 2014 at 4:21 pm
removed
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply