Returning Data from a Stored Procedure

Creating and Maintaining Databases

Creating and Maintaining Databases

Returning Data from a Stored Procedure

Microsoft® SQL Server™ 2000 stored procedures return data in four forms:

  • Output parameters, which can return either data (such as an integer or character value) or a cursor variable (cursors are result sets that can be retrieved one row at a time). For more information about using cursor variables, see Scope of Transact-SQL Cursor Names.

  • Return codes, which are always an integer value.

  • A result set for each SELECT statement contained in the stored procedure or any other stored procedures called by the stored procedure. For more information about using the SELECT statement, see Query Fundamentals.

  • A global cursor that can be referenced outside the stored procedure. For more information about using cursor variables, see Scope of Transact-SQL Cursor Names.