bulk import into many to many relationship, sql 2008, query
Posted on 2011-09-12
I have a three tables:
tableA (1:M) tableMtoM (M:1) L_tableB
The relationship between tableA and L_tableB is M:M hence tableMtoM.
TableB is a lookup table already populated.
I need to populate tableA first and then TableMtoM.
tableA columns: a_ID primary key , a_Description
tableB column: b_ID primary key, b_desc
tableMtoM columns: M_Id identity primary key, a_id foreign key, b_id foreign key
b_id can have many b_id's which should be stored in tableMtoM
M_id b_id a_id
1 300 88888
2 300 99999
3 300 11111
4 400 88888
5 400 11112
6 899 11111
how can I do a bulk import to populate tableMtoM?
Thanks in advance