-
Sort Order On Insert
Are there any techniques I can use to specify the sort order on an insert statement.
I want to insert data from tableA to tableB in a certain order .
I know I can do it with a cursor, but I'm sure theres a better way
Pargat
-
Sort Order On Insert (reply)
You could use the Order by in your select, or is it something more complex.
Insert into Table B
Seletc from Table A order by col1, col2, col3 etc...
------------
Pargat Bhatti at 6/22/01 5:44:15 AM
Are there any techniques I can use to specify the sort order on an insert statement.
I want to insert data from tableA to tableB in a certain order .
I know I can do it with a cursor, but I'm sure theres a better way
Pargat
-
Sort Order On Insert (reply)
It was slightly more complicated. You can't just use an insert with an order clause.
I had to use a derived table with top n statement. The derived table uses the order by clause, and ensures the data is inserted correctly.
If anyones interested I'll give them the code
------------
Pargat Bhatti at 6/22/01 5:44:15 AM
Are there any techniques I can use to specify the sort order on an insert statement.
I want to insert data from tableA to tableB in a certain order .
I know I can do it with a cursor, but I'm sure theres a better way
Pargat
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|