MS SQL Server Concepts and Programming Question:
Can Another User Execute Your Local Temporary Stored Procedures?
Answer:
Can another user execute your local temporary stored procedures? The answer is no.
To test this out, continue with the exercise from the previous tutorial. Keep that user session running and open a new client session with sqlcmd.exe. Then run the tutorial script below:
-- Executing permanent procedure
-- created by another user session
EXECUTE Hello 'globalguideline.com';
GO
Welcome to globalguideline
-- Executing local temporary procedure
-- created by another user session
EXECUTE #Hello 'globalguideline.com';
GO
Msg 2812, Level 16, State 62, Line 1
Could not find stored procedure '#Hello'.
To test this out, continue with the exercise from the previous tutorial. Keep that user session running and open a new client session with sqlcmd.exe. Then run the tutorial script below:
-- Executing permanent procedure
-- created by another user session
EXECUTE Hello 'globalguideline.com';
GO
Welcome to globalguideline
-- Executing local temporary procedure
-- created by another user session
EXECUTE #Hello 'globalguideline.com';
GO
Msg 2812, Level 16, State 62, Line 1
Could not find stored procedure '#Hello'.
Previous Question | Next Question |
How To Create a Local Temporary Stored Procedure? | What Are User Defined Functions in MS SQL Server? |