来自 SQL Server Update 语句的多条成功消息

Multiple success messages from SQL Server Update statement(来自 SQL Server Update 语句的多条成功消息)
本文介绍了来自 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 语句的多条成功消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)