Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Temporary Table?

Author  Topic 

Sprinjee
Starting Member

42 Posts

Posted - 2007-08-22 : 05:08:22
I'm working on an application that creates multiple workflows.

I have a stored procedure (SP_Check) that returns x Rows of workflow information. The user must see this information in an ASP, check the information returned rows and confirm or cancel based on the information. When confirming the rows are inserted in a table, it is then actual workflow(again using a stored procedure (SP_Insert)).

I would like to store the information return by SP_Check into a temporary table:

1 - So I can show it to the user and the data is temporary
2 - More over it's multi-user, the table should contain only the information used by the user. A caharactertis of temp tables is that if two different users both create a #Temporary table each will have their own copy of it. The exact same code will run properly on both connections.

However my stored procedure proc. SP_Check ends, as I need user input (confirm/cancel) before I can start the next stored procedure (SP_Insert). Consequently #temp table is dropped. Is there a way around this (preventing the table from being dropped, keeping the SP session open etc.) or is the only alternative creating an actual table storing the "users session id"?

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-22 : 05:14:53
looks like you need some info about temp table scopes:
http://weblogs.sqlteam.com/mladenp/archive/2006/11/03/17197.aspx

see if it helps.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Sprinjee
Starting Member

42 Posts

Posted - 2007-08-22 : 07:41:50
The document clarifies indeed the point in time the temporary table is lost. However is there a way to keep the session open after an sp has ended (as is the case when working in the Query Analyzer).
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-22 : 08:29:42
it is open until the connection is closed or the timeout happens.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -