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 |
BitShift
Yak Posting Veteran
98 Posts |
Posted - 2006-09-26 : 08:56:22
|
I have a stored procedure with a select statement setup like so:select .....into #tsumfrom ...where ...select a.* from #tsum aMy question is this:This works, but dont you have to define your temp table structure first ? |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-09-26 : 09:03:05
|
No. When using SELECT INTO, the temp table is using the same structure as the source(s) used in the SELECT statement.Peter LarssonHelsingborg, Sweden |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-09-26 : 11:03:14
|
Note that the indexes are not available in temp table if you use SELECT INTOMadhivananFailing to plan is Planning to fail |
 |
|
Westley
Posting Yak Master
229 Posts |
Posted - 2006-09-26 : 11:10:50
|
eekk, and inside a stored proc, it will have to recompile again since the temp table doesn't exists in design time, so it will need to recompile in run time......we got some script (bad ones) that have so many temp tables inside a stored proc, and it just so slow..... |
 |
|
|
|
|