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 Administration (2000)
 inserting records into table improper sequence

Author  Topic 

konica
Starting Member

2 Posts

Posted - 2004-12-10 : 20:23:46
We are inserting records into a table usin sql query analzyer . The records in the table will be extracted to a csv file using a utility program and sent to another company. The problem we are having is that the records do not get inserted into the table in the correct sequence. The records are selected from tables in the correct order, and then logic is applied in the fetch loop and then written to the hold table in a different seq. There is a hardcoded header record that gets insereted at the beginning of the program, before the main select that will appear as record 5600 in the table. There is also a trailer record hard coded at the end of the program that doesn't appear as the last record in the table. Does any have an answer as to why the records don't get inserted in the proper sequence
Thanks

nr
SQLTeam MVY

12543 Posts

Posted - 2004-12-10 : 20:45:45
Depends on how they are being inserted. Records in tables don't have any order and sql server won't necessarily insert in the order of records in a batch. To enforce order you need to have something that you can run an order by clause on.
Preventing parallelism may held but it really depends on the operations you are performing.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -