简体   繁体   English

获取已删除的列数

[英]Get deleted column count

Here's the DELETE query: 这是DELETE查询:

DELETE FROM Disk
WHERE
Disk.Name = 'Recovery'

How can I get deleted column count in sql-server ? 如何在sql-server获取已删除的列数?

Right after the statement do: 在语句之后立即执行:

set @num_deleted = @@rowcount

@@rowcount is a system variable that has the number of rows affected by the previous statement. @@rowcount是一个系统变量,具有受前一条语句影响的行数。 Read about it here . 在这里阅读。

If you want to ask more about the rows than merely the number, you can use the OUTPUT clause to put them into a table variable. 如果您要询问的不仅仅是行数,还可以使用OUTPUT子句将其放入表变量中。 You can then get the total number and other information about them. 然后,您可以获取总数以及有关它们的其他信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM