Different types of Stored Procedure in sql server.


Temporary Stored Procedures - SQL Server supports two types of temporary procedures:
  • Local temporary procedure
  • Global temporary procedure
Local temporary:
  • A local temporary procedure is visible only to the connection that created it.
  • Local temporary procedures are automatically dropped at the end of the current session.
Global temporary:
  • A global temporary procedure is available to all connections.
  • Global temporary procedures are dropped at the end of the last session using the procedure. Usually, this is when the session that created the procedure ends.
Temporary procedures named with # and ## can be created by any user.

System stored procedures are created and stored in the master database and have the sp_ prefix.(or xp_) System stored procedures can be executed from any database without having to qualify the stored procedure name fully using the database name master.

Automatically Executing Stored Procedures - One or more stored procedures can execute automatically when SQL Server starts. The stored procedures must be created by the system administrator and executed under the sysadmin fixed server role as a background process.
The procedure(s) cannot have any input parameters.

User stored procedure
Ebook Download
View all
Learn
View all