@@ROWCOUNT
来源:互联网 发布:安卓查看sqlite数据库 编辑:程序博客网 时间:2024/04/20 16:24
Transact-SQL statements can set the value in @@ROWCOUNT in the following ways:
Set @@ROWCOUNT to the number of rows affected or read. Rows may or may not be sent to the client.
Preserve @@ROWCOUNT from the previous statement execution.
Reset @@ROWCOUNT to 0 but do not return the value to the client.
Statements that make a simple assignment always set the @@ROWCOUNT value to 1. No rows are sent to the client. Examples of these statements are: SET @local_variable, RETURN, READTEXT, and select without query statements such as SELECT GETDATE() or SELECT 'Generic Text'.
Statements that make an assignment in a query or use RETURN in a query set the @@ROWCOUNT value to the number of rows affected or read by the query, for example: SELECT @local_variable = c1 FROM t1.
Data manipulation language (DML) statements set the @@ROWCOUNT value to the number of rows affected by the query and return that value to the client. The DML statements may not send any rows to the client.
DECLARE CURSOR and FETCH set the @@ROWCOUNT value to 1.
EXECUTE statements preserve the previous @@ROWCOUNT.
Statements such as USE, SET <option>, DEALLOCATE CURSOR, CLOSE CURSOR, BEGIN TRANSACTION or COMMIT TRANSACTION reset the ROWCOUNT value to 0.
The following example executes an UPDATE statement and uses@@ROWCOUNT to detect if any rows were changed.
USE AdventureWorks2008R2;GOUPDATE HumanResources.Employee SET JobTitle = N'Executive'WHERE NationalIDNumber = 123456789IF @@ROWCOUNT = 0PRINT 'Warning: No rows were updated';GO
- RowCount
- @@rowcount
- @@rowcount
- @@ROWCOUNT
- SET ROWCOUNT
- set Rowcount
- SET ROWCOUNT
- @@ROWCOUNT 函数
- ROWCOUNT 用法
- SQL%ROWCOUNT
- sql%rowcount
- sql%rowcount
- sql%rowcount
- @@ROWCOUNT 含义
- rowcount 和 @@rowcount 的用法
- 关于set rowcount和@@rowcount
- SQLSERVER的ROWCOUNT关键字
- @@ROWCOUNT (Transact-SQL)
- HTML 教程之基础篇【⒌】HTML 转义字符
- C_C++动态库与静态库详解
- SpinnerAdapter
- 使用stringstream对象简化类型转换
- 使用SharePreference保存用户输入的内容
- @@ROWCOUNT
- Visual Studio 2010快捷键
- 为何车轮,风扇等转动时,往往会看到似乎有缓缓倒转的现象?
- 封装一个MongoDB的 asp.net 链接类
- const用法详解
- python - threading
- 有编辑: RPC服务器不可用
- SVN使用帮助文档
- ffmpeg在编译中遇到的问题