What is a Stored Procedure?

A Stored Procedure is a set of T-SQL statements compiled into a single execution plan. It can return data in four ways.

  • A result set, each for every select statement.
  • Return codes, which always be integers.
  • Output Parameters, which always be a single value.
  • A Cursor, which return single row at a time.

A Stored Procedure can use of Transactions which can rollback data if any error occurs in the execution.


Create Procedure [Schema_Name].[Procedure_Name]
  -- @Parameters
  -- Set of T-SQL statements.