How To Create a Local Temporary Stored Procedure?
Submitted by: AdministratorA 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 'globalguideline.com';
GO
Welcome to globalguideline
EXECUTE #Hello 'globalguideline.com';
GO
Welcome to globalguideline.com
Submitted by: Administrator
* 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 'globalguideline.com';
GO
Welcome to globalguideline
EXECUTE #Hello 'globalguideline.com';
GO
Welcome to globalguideline.com
Submitted by: Administrator
Read Online MS SQL Server Job Interview Questions And Answers
Top MS SQL Server Questions
☺ | What Happens If NULL Values Are Involved in Arithmetic Operations? |
☺ | Can You Roll Back the DDL Statement in a Trigger? |
☺ | How To Use Subqueries in the FROM Clause in MS SQL Server? |
☺ | How To Enter Unicode Character String Literals in MS SQL Server? |
☺ | How To Write Character String Constants or Literals in MS SQL Server? |
Top Databases Programming Categories
☺ | RDBMS Interview Questions. |
☺ | SQL Interview Questions. |
☺ | SSRS Interview Questions. |
☺ | Sybase Interview Questions. |
☺ | Database Administrator (DBA) Interview Questions. |