March 14, 2003 at 7:58 am
I like to see the columns listed when you do an insert select.
Example:
Insert into #temp1
(column1,
column2)
Select column1,
column2
From table1
Instead of :
Insert into #temp1
Select column1,
column2
From table1
Is there any difference in performance or which way is programtically better?
Thank You!
Carol
March 14, 2003 at 8:08 am
No difference ion performance, however I agree that it is better to explicitly state the columns in INSERT ... SELECT statements, as well as INSERT ... VALUES statements. The worst way is this:
INSERT INTO #temp1
SELECT * FROM table1
--
Chris Hedgate @ Apptus Technologies (http://www.apptus.se)
March 14, 2003 at 9:16 am
It happens occasionally that someone will add a column to a table and sometimes place it in the middle of the previous table structure. Without using column names, all of your previous insert queries would be broken till you fixed them. 2nd vote for using names, also it is much clearer for the next guy who comes along and has to debug your sql what you were explicitly trying to do.
Tim C.
//Will write code for food
Tim C //Will code for food
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply