Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server: Selecting 1 rows results in 1+3 rows affected?

i'm selecting 1 row from a table:

select * from LCTs WHERE LCTGUID = 'B642B9E6-779A-4FD0-8514-294EAF87A9A6'

(1 row(s) affected)

(3 row(s) affected)

How can i get 4 rows affected by a single select (especially since it returns only one row)?

Bonus information:

  • SQL Server 2000
  • LCTs is a real table (i.e. not a view or UDF)
  • there is no triggers on the table
  • this is SQL Server 2000, which has no DDL auditing

Even more bizarre is that if i update that one row:

update LCTs SET IsDirty = 1 WHERE LCTGUID = 'B642B9E6-779A-4FD0-8514-294EAF87A9A6'

(1 row(s) affected)   

(5 row(s) affected)

How is an update of one row affecting 6 rows, in a table, without triggers, in SQL Server 2000?

like image 482
Ian Boyd Avatar asked Dec 29 '22 05:12

Ian Boyd


1 Answers

This can happen if you have Show Actual Execution Plan turned on. The second rowcount is for transferring the execution plan data.

like image 152
Andomar Avatar answered Jan 14 '23 06:01

Andomar