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
 Import/Export (DTS) and Replication (2000)
 correct imported table with sql

Author  Topic 

NTC
Starting Member

21 Posts

Posted - 2007-12-06 : 14:01:29
I know the wrap spacing doesn't always work but will try to represent the table that is being imported from an unknown system;

key Field1 Field2
1 X 105
2 abc 123
3 abc 111
4 btb aff
5 sym 0101
6 X 106
7 abc 144
8 sym 2121

from a database perspective X is a unique record and everything between them belongs to its preceeding X. Right now the only way to know that ABC 123 is part of the X105 record (while ABC144 is part of X106 record) is because the autonumber key generated during the import puts them in sequential order.

The record quantity between Xs is variable.

One doesn't want to rely upon the autonumber.

So I need to run it thru a query to generate a better cross reference field and make a new table

key Field1 Field2 Field3
1 X 105 X105
2 abc 123 X105
3 abc 111 X105
4 btb aff X105
5 sym 0101 X105
6 X 106 X106
7 abc 144 X106
8 sym 2121 X106


Would greatly appreciate assist on the correct sql to do the job....gracias.
   

- Advertisement -