what do rows were affected mean

  • 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

  • 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)".

    😎

  • 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

  • That is a fair guess as the after trigger execution is appended to the insert statement in the execution plan.

    😎

  • 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.

  • removed

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply