sql server - SSIS Multiple flat files into tables with Parent Child -
this tables in sql server:
table: customer (custnum pk , auto increments) custnum firstname lastname 123 bob smith 456 john paton 789 fred bloggs table: job (custnum fk, jobnum pk , auto increments) jobnum custnum item desc 852 123 abcde widgets 654 456 wert more widgets 987 789 qwe mouse mat
i have data coming 2 csv's in below format
table: customer firstname lastname bob smith john paton fred bloggs table: job item desc abcde widgets wert more widgets qwe mouse mat
i need import customers jobs sql tables maintain referential integrity. when job record created, needs lookup correct custnum - how do this? have found many examples doing 1 cs file, not multiple csv's. also, there no reliable key tie job rows customer table - don't think able use ssis lookup - i?
you can use ssis package feed data base.
the package it
custnum firstname lastname ----------- ---------- ---------- 1 bob smith 2 fred bloggs 3 john paton
result
jobnum custnum item desc ----------- ----------- ---------- -------------------------------------------------- 1 1 abcde widgets 2 2 qwe mouse mat 3 3 wert more widgets
how it:
main task:
add dts customer
add dts job
create flow (green arrow) customer job
customer dts
add connection customer file
add connection customer sql
sort both outputs firstname, lastname
insert , configure conditional split 1 output called "new" , expression
isnull(custnum)
insert customer table
job dts
Comments
Post a Comment