|
Transact-SQL User's Guide
|
Stored procedures
One of the most important Transact-SQL extensions is the ability
to create stored procedures. A stored procedure is
a collection of SQL statements and optional control-of-flow statements
stored under a name. The creator of a stored procedure can also
define parameters to be supplied when the stored procedure is executed.
The ability to write your own stored procedures greatly enhances
the power, efficiency, and flexibility of the SQL database language.
Since the execution plan is saved after stored procedures are run,
stored procedures can subsequently run much faster than standalone
statements.
Adaptive Server-supplied
stored procedures, called system procedures, aid
in Adaptive Server system administration. Chapter 14, "Using Stored Procedures," discusses system procedures and explains
how to create stored procedures. System procedures are discussed
in detail in the Reference Manual.
Users can execute stored procedures on remote servers. All
Transact-SQL extensions support return values from stored procedures,
user-defined return status from stored procedures, and the ability
to pass parameters from a procedure to its caller.