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)
 Temp tables or variable tables

Author  Topic 

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2006-03-07 : 07:43:05
I have got into the habit of creating all my tables in my procs a variable ones.

Is this the most efficient way to work, or should I be using temp tables instead?

I chose variable tables as I presumed being in memory they would be faster than temp ones, but am now thinking that if all my procs do this and many users run them then surely memory availability becomes an issue?

Also I do not dispose of any variable or temp table(when created) as I read that they are automatically dropped when the proc ends. Is this correct too?

Thanks


chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-03-07 : 07:50:18
Check out this link
http://www.aspfaq.com/show.asp?id=2475
it may be help ful..

if its the local temp table(#temp) then you dont have to dispose them, their scope only within their procedure, but if you are using global temp table (##Temp) then its scope is till the connection is active.



Sucess Comes to those who Believe in Beauty of their Dream..
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-07 : 08:02:00
Also refer http://support.microsoft.com/default.aspx?scid=kb;en-us;305977

Madhivanan

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

hog
Constraint Violating Yak Guru

284 Posts

Posted - 2006-03-09 : 03:31:33
Thanks chaps :)
Go to Top of Page
   

- Advertisement -