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 |
|
kote_alex
Posting Yak Master
112 Posts |
Posted - 2009-10-26 : 07:51:14
|
| insert into xxx from select * from Table1insert into xxx from select * from Table2OR ?insert into xxx from select * from Table2union allselect * from Table2 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-10-26 : 08:12:11
|
I would believe the version using UNION is faster because there is only one INSERT statement.But you have to try it out to be sure. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
mfemenel
Professor Frink
1421 Posts |
Posted - 2009-10-26 : 09:50:51
|
| I'd lean towards the union statement. Both statements are going to read from table 1 and 2 but you're only going to lock table xxx once if you do it as a union, rather than acquire/drop/reqacquire that would happen with multiple inserts. If you're doing this as part of an SSIS package or BCP you might also consider using the table lock option to squeeze more speed out of it.Mike"oh, that monkey is going to pay" |
 |
|
|
kote_alex
Posting Yak Master
112 Posts |
Posted - 2009-10-27 : 04:39:24
|
| okey, thank guys ! |
 |
|
|
|
|
|