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
 General SQL Server Forums
 New to SQL Server Programming
 Temporary tables

Author  Topic 

fkzeljo
Starting Member

1 Post

Posted - 2007-11-02 : 17:57:21
Hello,

Our java application is running on oracle and now we would like to port it to sql server 2000. In oracle we have a global temporary tables that has an option on commit to delete rows.
Now I am looking for the same option in sql server but as far as I can see sql server's local temporary tables are visible per connection. Since the connection are shared in the pool it seems I can not rely on local temporary tables since the connection does not get closed at the end of the user's session. I need something that is visible per transaction not per connection.

Is it a better approach just to create a regular table and basically have a trigger to delete all data on commit?

Van
Constraint Violating Yak Guru

462 Posts

Posted - 2007-11-02 : 18:00:07
There are global temporary tables in SQL. You have to use two ## instead of one #.

##temptable

instead of

#temptable
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-11-03 : 02:42:53
The COMMIT part is not going to work for you though. The rows won't be visible to other processes unless they are committed. You can TRUNCATE the table to remove all its rows.

Kristen
Go to Top of Page
   

- Advertisement -