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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Sorting when Inserting

Author  Topic 

miranwar
Posting Yak Master

125 Posts

Posted - 2003-05-30 : 11:11:58
Hi Can someone tell me how I can insert into a table in a specific order. Running the query below sorts all recs in #inv by country code however on another server it does not work. Is there a database setting for this.

insert #Inv
(chShowCd, iShowYear, iIndividualId, iAddressTypeId, iInvoiceNumber, iOwnerId, vchCompanyName, chCountryCode)
select chShowCd, iShowYear, iIndividualId, iAddressTypeId, iInvoiceNumber, iOwnerId, vchCompanyName, chCountryCode
from #InvSortedUS
order by chCountryCode, vchCompanyName, iInvoiceNumber

cas_o
Posting Yak Master

154 Posts

Posted - 2003-05-30 : 11:16:56
May I ask why you need the data to be ordered in the table?

surely you can order it however you need when selecting for export or display or whatever.

;-]
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-05-30 : 11:26:05
There's no such thing as row order in SQL 2000...

Sam

Go to Top of Page

cas_o
Posting Yak Master

154 Posts

Posted - 2003-05-30 : 11:34:41
Then how pray do clustered indexes work ???

;-]
Go to Top of Page
   

- Advertisement -