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.
Author |
Topic |
neubitiy
Starting Member
2 Posts |
Posted - 2011-05-05 : 05:31:47
|
Hi all,I have csv-file with complicated structure (it is export from OEBS) - order header and order line. It look like:header1line11line12line13header2line21line22line23Header and line records have different fields.Next header section begins with empty string.Can I import data from this file to two table (Order and OrderLine)?(SQL Server 2008 R2) |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-05-05 : 05:36:04
|
I would prefer to split the file into two files and then import them step by step. No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
neubitiy
Starting Member
2 Posts |
Posted - 2011-05-05 : 06:14:06
|
it's impossible becuase we receive these files from our customer :( |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-05-05 : 11:18:23
|
I have suffered through a similar situation. What I did was to import the file into a staging table in the database that has a single varchar(max) column. Then I processed the data from the staging table into other tables. The logic of deciding whether something is a header1 row or header 2 row or detail row, which tables to put it into etc. were all done in T-SQL. |
|
|
|
|
|