Hi all,
I have an XLS file with the following rows:
store name - idtype1 - idtype2 - idtype3
store 1 - 1a - 1b - 1c
store 2 - 2a - 2b - 2c
There are actually 5 ID types and over two hundred stores, there are also columns such as address, email etc. What I need to do is load this data into two tables,one being the main store info, name, address email and an internal id. The second is the idtypes, so i would use the internal id as as a foreign key:
storeid - store name - address 1 - store 1 - 132 2 - store 2 - 465
storeid - idtypeid
1 -1a
1 -1b
1 -1c
I am trying to figure out the best way to load this information in. So that I take the flat XLS create the main store table then for each row create the foreign key references in the second table.
I can not figure out how to approach this, DTS, T-SQL or how I would actually do it.
Thanks
EDIT
one way I could do it (at least only sudo solution I can think of), create temp table with all records, load the whole xls file. Iterate through the table, one row at a time. insert required fields into main store table, get ID created, do multiple inserts into foreign key table to create each different reference.
I have no idea how to code this in DTS or T-SQL!