|
Home >> FAQs/Tutorials >> SQL Server FAQ
SQL Server FAQ - Creating Local Temporary Stored Procedures
By: FYIcenter.com
(Continued from previous topic...)
How To Create a Local Temporary Stored Procedure?
A local temporary stored procedure is a special stored procedure that:
- Is created like a normal (permanent) stored procedure with the name prefixed
with a number sign (#).
- Are only valid in the same client session where it was created.
- Will be deleted when creating session is terminated.
This tutorial exercise here creates two stored procedures,
one is permanent and the other is local temporary:
DROP PROCEDURE Hello;
DROP PROCEDURE #Hello;
GO
CREATE PROCEDURE Hello
@url nvarchar(40)
AS
PRINT 'Welcome to ' + REVERSE(@url);
GO
CREATE PROCEDURE #Hello
@url nvarchar(40)
AS
PRINT 'Welcome to ' + @url;
GO
EXECUTE Hello 'fyicenter.com';
GO
Welcome to moc.retneciyf
EXECUTE #Hello 'fyicenter.com';
GO
Welcome to fyicenter.com
(Continued on next topic...)
- What Are Stored Procedures?
- How To Create a Simple Stored Procedure?
- How To Execute a Stored Procedure?
- How To List All Stored Procedures in the Current Database?
- How To Drop an Existing Stored Procedure?
- How To Create a Stored Procedure with a Statement Block?
- How To End a Stored Procedure Properly?
- How To Generate CREATE PROCEDURE Script on an Existing Stored Procedure?
- How To Get the Definition of a Stored Procedure Back?
- How To Modify an Existing Stored Procedure?
- How To Create Stored Procedures with Parameters?
- How To Provide Values to Stored Procedure Parameters?
- What Are the Advantages of Passing Name-Value Pairs as Parameters?
- Can You Pass Expressions to Stored Procedure Parameters?
- How To Provide Default Values to Stored Procedure Parameters?
- How To Define Output Parameters in Stored Procedures?
- How To Receive Output Values from Stored Procedures?
- How To Create a Local Temporary Stored Procedure?
- Can Another User Execute Your Local Temporary Stored Procedures?
|