資料指標 (Transact-SQL)cursor (Transact-SQL)

適用於: 是SQL Server 是Azure SQL Database 否Azure Synapse Analytics (SQL DW) 否平行處理資料倉儲 APPLIES TO: yesSQL Server yesAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

參考資料指標的變數或預存程序 OUTPUT 參數的資料類型。A data type for variables or stored procedure OUTPUT parameters that contain a reference to a cursor.

RemarksRemarks

以下是可參考 cursor 資料類型之變數和參數的作業:The operations that can reference variables and parameters having a cursor data type are:

  • DECLARE @local_variable 和 SET @local_variable 陳述式。The DECLARE @local_variable and SET @local_variable statements.
  • OPEN、FETCH、CLOSE 和 DEALLOCATE 資料指標陳述式。The OPEN, FETCH, CLOSE, and DEALLOCATE cursor statements.
  • 預存程序輸出參數。Stored procedure output parameters.
  • CURSOR_STATUS 函數。The CURSOR_STATUS function.
  • sp_cursor_listsp_describe_cursorsp_describe_cursor_tables,及 sp_describe_cursor_columns 系統預存程序。The sp_cursor_list, sp_describe_cursor, sp_describe_cursor_tables, and sp_describe_cursor_columns system stored procedures.

sp_cursor_listsp_describe_cursorcursor_name 輸出資料行會傳回 cursor 變數的名稱。The cursor_name output column of sp_cursor_list and sp_describe_cursor returns the name of the cursor variable.

任何使用 cursor 資料類型建立的變數都可為 Null。Any variables created with the cursor data type are nullable.

cursor 資料類型不能用於 CREATE TABLE 陳述式中的資料行。The cursor data type cannot be used for a column in a CREATE TABLE statement.

另請參閱See also

CAST 和 CONVERT (Transact-SQL)CAST and CONVERT (Transact-SQL)
CURSOR_STATUS (Transact-SQL)CURSOR_STATUS (Transact-SQL)
資料類型轉換 (資料庫引擎)Data Type Conversion (Database Engine)
資料類型 (Transact-SQL)Data Types (Transact-SQL)
DECLARE CURSOR (Transact-SQL)DECLARE CURSOR (Transact-SQL)
DECLARE @local_variable (Transact-SQL)DECLARE @local_variable (Transact-SQL)
SET @local_variable (Transact-SQL)SET @local_variable (Transact-SQL)