CREATE #TABLE is faster then INTO #Table

Last Post 07 May 2007 05:00 AM by skt5000. 3 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
darsh
New Member
New Member

--
02 May 2007 11:10 AM
I wrote a small stored procedure which was something like this.

.....
Select x,y,z
Insert into #Temp1
where .....

one of my collegue asked me to change this as per the below.

....
Create table #Temp1(x,y,z)
Insert into #Temp1
Select x,y,z

I need your help to understand is this something beneficial in order to CREATE table first ?

darsh
New Member
New Member

--
04 May 2007 05:46 AM
Thanks rm, for correcting me in terms of syntax.


Thanks russellb, for giving me good suggestion, it will help me lots.

Stored procedure which i'm modifying write now, that has almost more then 20 temp tables.

I'm trying to find out other alternate too so i can get rid of this temp table.

SQLUSA
New Member
New Member

--
05 May 2007 01:00 AM
Pardon my ignorance Russell, but why is it faster?

Both cases, it is not logged operations.

Are we talking about trivial difference, or significant?

There is nothing in my experience and knowledge set which would support this assertion.

I will run a few tests on large tables.

Kalman Toth, Business Intelligence Architect
The Best Business Intelligence Training in the World - http://www.sqlusa.com/businessintelligence


skt5000
New Member
New Member

--
07 May 2007 05:00 AM
Would you expect different results if you select into #NewTable instead of select into NewTable?

Jim
You are not authorized to post a reply.

Acceptable Use Policy