I have the following tables (simplified for question):
Data:
Id
Serialnumber
Value
AddressId (ForeignKey)
Addresses:
Id
Street
ZipCode
City
...
Now I have a csv file which contains data, unfortunately for both tables:
Serialnumber,Value,Street,ZipCode,City, ...
12345,1140,Fakestreet 3,12345,New York
5678,830,Fakestreet 87,12345,New York
Is there any way to import csv files like that to Microsoft SQL server (2008)? The server itself has to insert the address first, then use the primary key of the Addresses table as foreign key in the Data table.