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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-08-31 : 07:15:05
|
| vas writes "i have seen that we can declare a tempory table bydeclare @temp tablealso #temp which is betterand i have seen in sql reporting #temp declaration causes problemplease can anyone give me the exact diffand which is efficient method of declaration" |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-08-31 : 08:46:40
|
| Hi vas, Welcome to SQL Team!#temp will create a physical table in tempdb. @temp will create the table in memory, but may create it on disk#temp can therefore be slower, and possibly use up all available space in tempdb.#temp will rollback [I'm pretty sure], @temp definitely won'tYou can only have a PK on @temp, I'm pretty sure you can have regular indexes on #temp as well as a PK##temp tables are global, no global equivalent of @@tempYou cannot doSELECT *INTO @tempFROM ...INSERT INTO @tempEXEC MyStoredProcedure ...BoL says that @temp used in SProc will cause fewer recompilations of the SProc than #tempThat's about all I can think ofKristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-31 : 08:57:22
|
| Temp table can handle many rows when compared with table variableYou can alter temp table but you cannt alter table variableMadhivananFailing to plan is Planning to fail |
 |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2005-08-31 : 12:06:45
|
| As for the effects in SQL Server Reporting Services, the designer will throw a funny message if your stored procedure uses a temp table, something to the effect of it cannot determine the columns. However, if you simply click on the Refresh Columns button and on the Execute Dataset button on the dataset tabs, it figures them out just fine.---------------------------EmeraldCityDomains.com |
 |
|
|
|
|
|