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.
| Author |
Topic |
|
astromenix
Starting Member
3 Posts |
Posted - 2005-05-31 : 02:57:25
|
hello everyone,i got a stored proc that makes use of quite a few table variables, join em to get the data is needed.there are quite a few articles on the web on table variables that they advise to use tbl variables instead of temp tables.i m just a little concearned as my proc is geetin lengthy, and as most of the times table variables are kept excusively in memory.So i end up keep them till the end of the proc where the session ends...i havent seen any referense of whether is sensible to emtpy, using a "delete All" statement after variable not needed anymore, or just do nothing.i know is better to break up my code into smaller procs, but it seems hard to achievethat as among different step i do work in proc, the outcome is two dimension arrays of dates...thanx in advance for any thoughts and advice or ponting me to relevant sources on the subject. |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2005-05-31 : 03:03:13
|
| table variables are variables, when the sproc finishes so does it's existence, no need to truncate it in the sproc if there is no need--------------------keeping it simple... |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-05-31 : 04:06:51
|
| This applies to temporary tables alsoMadhivananFailing to plan is Planning to fail |
 |
|
|
astromenix
Starting Member
3 Posts |
Posted - 2005-05-31 : 06:04:01
|
| i know that my table variables will last till the end of my proc, i was just wondering whether is a gud idea to get rid of the data in them, before the end as they contain not much data n will b kept on memory.Actaully do u think is too much i m using around 7-9 table variables in one proc?its seems like i cant avoid it tho to do the data processing i need to |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2005-05-31 : 14:21:24
|
| best practice is to acquire a resource as LATE as possible, and to release it as SOON as possible. <-- Over generalization*need more coffee* |
 |
|
|
|
|
|
|
|