Page 1 of 1

Improved Performance For Temp Table

Posted: Fri Nov 16, 2007 7:36 am
by jstorm13
Hello:

Can anyone tell me if this should work out ok. I don't really like working
on my live server but want to make a change.

----------------------------------------------------
Currently I have:
~~~~~~~~~~~~~~~~~
SELECT
blah,
blah,
blah
into #temptable
FROM SourceTable
INNER JOIN ........

I am having some performance issues. I have read
not to use Select Into.
----------------------------------------------------
I am thinking about using:
~~~~~~~~~~~~~~~~~~~~~~~~~~
SELECT *
INTO #temptable
FROM SourceTable
WHERE 1 = 0

CREATE clusteredindex iname on #temptable (blah, blah)

INSERT #temptable
SELECT *
FROM SourceTable
INNER JOIN ..............

I am hoping this will improve performance but I want
to be sure I have the syntax correct. If I create
the clustered index then insert the data will it
work the way I am hoping?
----------------------------------------------------


Thanks for any help on this guys...

Posted: Fri Nov 16, 2007 1:58 pm
by Weirdan
what database server you're using? oracle, mssql, something else?