I have huge amount of data structured in two excel sheets with the following columns:
EXCEL DATA
Sheet1 [pod, client, address, ...etc] -one record per [pod]
Sheet2 [pod, pointofmeasure, typepct, ...etc] -one-to-many records per [pod]
-relationship is between sheet1.pod and sheet2.pod (one-to-many relationship)
I need a sql to insert data from that excel sheets into a access database with the following tables structure:
ACCESS DATABASE
Table1 [id, pod, client, address, ...etc]
Table2 [id, pod_id, pod, pointofmeasure, typepct, ...etc]
Where table2.pod_id = table1.id
Can be do it in one sql insert?
I came up with this mass insert...
cn.Open scn
ssql = "INSERT INTO table1 (pod, client, address, ...etc) "
ssql = ssql & "SELECT * FROM [Excel 8.0;HDR=YES;DATABASE=" & dbWb & "].[sheet1$]"
cn.Execute ssql, cAffectedRows
cn.Close
Now how the hell i get id's to insert data to table2 ?