Reputation: 85
The project I have been working on can be broken into two different stored procedures.
I am trying to execute the first stored procedure and store the temp table in a session and then run the second stored procedure manually obtain another table that uses.
-EDIT-
SP1 takes about 30s to set up a temp table by joining many tables, and I want to use the temp table from SP1 not just for SP2 but many different SPs.
I'm not sure if this is possible?
Upvotes: 0
Views: 708
Reputation: 66
No it's not possible as the local temporary tables have scope to only current session.
You can create local and global temporary tables. Local temporary tables are visible only in the current session, and global temporary tables are visible to all sessions [Source :MSDN]
If you are trying to create this for a web application I suggest you to create Stored Procedure (which wraps both stored procedures execution) and the creation of temp table should be at the outer stored procedure. Then it will be available to both the stored procedures that are invoked from this procedure.
Going with global temporary tables is also not a reliable solution.
Upvotes: 3