来自 SQL Server Update 语句的多条成功消息
我有以下查询应该更新 716 条记录:
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';
但是,当从 SSMS 中的查询窗口在 SQL Server 2005 数据库上运行此查询时,我收到以下三个消息:
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
那么为什么我会收到 3 条消息(而不是单个更新语句的正常消息)以及 10814 可能指的是什么?这是一个我需要更新的生产数据库,所以我不想在不知道答案的情况下提交这些更改 :-) 谢谢.
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.
推荐答案
这可能是由 [samp] 表上的触发器引起的.如果你去 Query -> Query Options -> Execution -> Advanced 并检查 SET STATISTICS IO,当你运行查询时,你会看到还有哪些表正在更新.
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.
相关文章