DECLARE CURSOR如果使用 Transact-SQL 語法未指定READ_ONLY、OPTIMISTIC或SCROLL_LOCKS, 則預設值如下: SELECT如果語句不支援更新(許可權不足、存取不支援更新的遠端資料表等等),則資料指標為READ_ONLY。 STATIC和FAST_FORWARD資料指標預設為READ_ONLY。 DYNAMIC和KEYSET資料
DECLARE CURSOR 语句的第一种格式使用 SQL-92 语法声明游标行为。DECLARE CURSOR 的第二种格式使用 Transact-SQL 扩展,使您得以使用在 ODBC、ADO 和 DB-Library的数据库 API 游标函数中的相同游标类型定义游标。 不能混淆这两种格式。如果在 CURSOR 关键字的前面指定 SCROLL 或 INSENSITIVE 关键字,则不能在 CURSOR...
cursor_name 定义的 Transact-SQL Server 游标的名称。 cursor_name 必须符合有关标识符的规则。 LOCAL 指定该游标的范围对在其中创建它的批处理、存储过程或触发器是局部的。 该游标名称仅在这个作用域内有效。 在批处理、存储过程、触发器或存储过程OUTPUT参数中,该游标可由局部游标变量引用。OUTPUT参数用于将局部...
Defines the attributes of a Transact-SQL server cursor, such as its scrolling behavior and the query used to build the result set on which the cursor operates.
The name of the Transact-SQL server cursor defined. cursor_name must conform to the rules for identifiers.LOCALSpecifies that the scope of the cursor is local to the batch, stored procedure, or trigger in which the cursor was created. The cursor name is only valid within this scope. The ...
Definiert die Attribute eines Transact-SQL-Servercursors, wie z. B. dessen Scrollverhalten sowie die Abfrage, die zum Erstellen des Resultsets verwendet wird, in dem der Cursor ausgeführt wird. DECLARE CURSOR akzeptiert sowohl eine Syntax basierend auf dem ISO-Standard als auch eine Syntax, ...
在SQL Server 2000 中,FAST_FORWARD 和 FORWARD_ONLY 游标选项是互相排斥的。如果指定了二者,则会引发错误。在 SQL Server 2005 及更高版本中,这两个关键字可以用在同一个 DECLARE CURSOR 语句中。 READ_ONLY 禁止通过该游标进行更新。在 UPDATE 或 DELETE 语句的 WHERE CURRENT OF 子句中不能引用该游标。该选...
代码如下:begindeclare @class_noidA char(4), @class_noidB char(4),@spnoidA char(8),@spnoidB char(8)declare class_cursorA cursor local forward_onlyfor select class_no,spno from deleteddeclare class_cursorB cursor local forward_onlyfor select class_no,spno from insertedopen ...
DECLARE cursor_name [ INSENSITIVE ] [ SCROLL ] CURSOR FOR select_statement [ FOR { READ ONLY | UPDATE [ OF column_name [ ,...n ] ] } ][;]Transact-SQL Extended Syntax DECLARE cursor_name CURSOR [ LOCAL | GLOBAL ][ FORWARD_ONLY | SCROLL ][ STATIC | KEYSET | DYNAMIC |...
SQL Server implicitly converts the cursor to another type if clauses in select_statement conflict with the functionality of the requested cursor type. For more information, seeUsing Implicit Cursor Conversions. READ ONLY Prevents updates made through this cursor. The cursor cannot be referenced in ...