来自 SQL Server Update 语句的多条成功消息 [英] Multiple success messages from SQL Server Update statement

查看:38
本文介绍了来自 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.

这篇关于来自 SQL Server Update 语句的多条成功消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆