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


基础教程推荐
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01