Multiple success messages from SQL Server Update statement
message, sql, sql-server, sql-update
Solution
This is likely caused by a trigger on the [samp] table. If you go to Query -> Query Options -> Execution -> Advanced and check SET STATISTICS IO, you will see which other tables are being updated when you run the query.
Problem
I have the following query that SHOULD update 716 records: ``` USE db1 GO UPDATE SAMP SET flag1 = 'F', flag2 = 'F' FROM samp INNER JOIN result ON samp.samp_num = result.samp_num WHERE result.status != 'X' AND result.name = 'compound' AND result.alias = '1313' AND sample.standard = 'F' AND sample.flag2 = 'T'; ``` However, when this query is run on a SQL Server 2005 database from a query window in SSMS, I get the following THREE messages: ``` 716 row(s) affected 10814 row(s) affected 716 row(s) affected ``` So WHY am I getting 3 messages (instead of the normal one for a single update statement) and WHAT does the 10814 likely refer to? This is a production database I need to update so I don't want to commit these changes without knowing the answer :-) Thanks.