Groups | Blog | Home
all groups > sql server (microsoft) > september 2007 >

sql server (microsoft) : Problem with Select Into and Insert Into.. Records Always Inserted at the Top


PavanR
9/21/2007 7:44:02 AM
Friends,

Take a look at the Code Below :

drop table t5
go
Select * into T5 from (Select * from T1) a
Insert Into T5 (f1,f2) (select top 2 f1,f2 from T2 )

The above code from a T-SQL always inserts Records from T2 at the TOP
of T5.. have also tried dividing Select Into and Insert Into in two
different blocks of BEGIN TRANS.. Commit but same results..
Incidentally if T5 is not created with Select Into and Already Exists
than the records are inserted at the bottom..

Any Idea how to get above code working to Insert Records from T2 at
the end records of T5 (am I missing any SET/Options)

thanks

Pavan rai
Ed Murphy
9/21/2007 8:10:01 PM
[quoted text, click to view]

Tables have no inherent order. You need to impose one at SELECT time,
AddThis Social Bookmark Button