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 Table

Author  Topic 

asm
Posting Yak Master

140 Posts

Posted - 2005-11-08 : 05:35:11
Hi

I have to create a temporary table for generating a report in VB.
Pls help how to check the temporary table name in database.
I want if exits than drop and create a new one.


thanks

asm


madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-08 : 05:42:16

If object_id('tempdb..#t') is not null
Drop table #t
else
Create table #t(i int)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2005-11-08 : 08:33:08
Make sure you are creating a true temporary table (preceded with the # sign), and not a permanent table "temporarily" (a recipe for disaster in a multi-user environment).
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-08 : 08:40:01
quote:
Originally posted by blindman

Make sure you are creating a true temporary table (preceded with the # sign), and not a permanent table "temporarily" (a recipe for disaster in a multi-user environment).


Thats Good point

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -