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 |
|
smithani
Starting Member
42 Posts |
Posted - 2007-08-27 : 22:12:16
|
| Hello Tsql experts,Can you please explain to me what the differnce is between selecting into a table and creating a new tabel and inerting in to it like so:First way:select names into #ancestorsfrom names andsecond waycreate table #names(name varchar(10))insert into #names (name) values(name)select names from namesis it just personal choice or performance in one method is better than the other.Can you please explain.Thanks |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-08-27 : 22:26:40
|
| Depends on rows involved, someone said that second way has better performance with lager amount of data. |
 |
|
|
Koji Matsumura
Posting Yak Master
141 Posts |
Posted - 2007-08-27 : 22:43:20
|
| At least you have more control using the second method such as NULL or NOT NULL.It maybe required to insert addtional records in following statements. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-08-28 : 02:29:52
|
| Also if you use first method temp table wont have any indices that source table have. So it is always better to go for method 2MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|