0

I have a csv file with 50 columns and i need to insert csv data into 2 tables.

first table should have first 10 columns and the second table should have the remaining 40 columns data in 10 columns.

csv file has 50 columns

co1 col2 col3 col4 -----col50.

first table

col1 col2 col3----col10

second table

col11 col12 col13----col20(first row)

col21 col22 col23----col30(second row)

col31 col32 col33----col40(third row)

col41 col42 col43----col50(fourth row)
DanB
  • 2,022
  • 1
  • 12
  • 24
Vijay
  • 1

1 Answers1

0

I would suggest creating a temp table and loading the entire csv file into the temp table. Once you have the temp table loaded with all the data from the file, you can now selectively insert just the first 10 columns from the temp table into your table 1. You might want to refer insert into select documentation for this. Similarly you can have multiple insert statements for table 2 that target columns: col11 col12 col13----col20 col21 col22 col23----col30 col31 col32 col33----col40 col41 col42 col43----col50

raj
  • 819
  • 5
  • 9