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 |
|
Bex
Aged Yak Warrior
580 Posts |
Posted - 2004-08-13 : 04:42:47
|
| Good morn to you all!Yesterday, I learnt about creating temporary tables or using table variables to hold data. Why are table variables more optimal than using temp tables - can anyone explain the difference to me? ThankyouBexxxHearty head pats |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2004-08-13 : 05:13:03
|
| Look up table variables in books online, it will give you a reasonable overview.-------Moo. :) |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2004-08-13 : 06:11:42
|
| Greatest difference is that temp-tables get written to the temp-db which requires some IO, but table-variables are only stored in memory like any other normal variable and is only existing within the scope of the transaction/batch. BOL: "Use table variables instead of temporary tables, whenever possible".--Lumbago"Real programmers don't document, if it was hard to write it should be hard to understand" |
 |
|
|
Bex
Aged Yak Warrior
580 Posts |
Posted - 2004-08-13 : 07:02:30
|
| Cheers guys,i found some really useful information at this location. I just typed it all in, but then there was a problem with my password, so everything I typed has been erased! Sorry, but I cannot be bothered to type it all again, but this article lists the pros and cons. So if anyone is interested in this subject, below is the place to go: http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q305977Have a good afternoon!Hearty head pats |
 |
|
|
|
|
|