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)
 Import and combine

Author  Topic 

MikeBrenner
Starting Member

1 Post

Posted - 2002-08-29 : 11:41:45
We have a very large file (approx 500,000) records that we are attempting to import into an existing database. The old records come from an AS400 and each record was split up into several rows (with several rows acutally completing the one record). The layout is as follows:

Record 1
Customer - 55551
ID - 112
Order - 1
Text - Start of note

Record 2
Customer - 55551
ID - 112
Order - 2
Text - next line

Record 3
Customer - 55551
ID - 113
Order - 1
Text - Next Note

What we need to do is to insert these new records into a new table with the text of the notes combined..

Record 1
Customer - 55551
ID - 112
Order - 1 (does not need to be imported)
Text - Start of note next line

This will do 2 things, reduce the number of rows, and make the selection of these records easier for the users.

Does anyone have any ideas as to how we can combine this line on insert??


royv
Constraint Violating Yak Guru

455 Posts

Posted - 2002-08-30 : 10:26:25
I would create a temp table to BULK INSERT the data into, and to then massage the data via an INSERT SELECT statement to get the data into your table the way you want. If you are using SQL 2000, instead of temp tables use table variables.

*************************
Someone done told you wrong!
Go to Top of Page
   

- Advertisement -