Well, it's not incredibly easy, or I'd let you have it. ;-) The short answer is you have to do it in the other order: handle the address part first, and the customer part second.
Your flat file db repeats address information and is thus denormalized. It sounds like you've normalized the data model in SQL Server, so in addition to loading the data into the database, you need to normalize it. In this case that means generate only one row for each unique address. You can use Perl to simplify the work a little bit depending on the amount of data you're processing.
Basically, when you read a row, separate the address information and look that up in the address table first. If you get a row, remember the key value, and use that when you insert the customer data. (The Perl simplification in the case of a small data set would be to save the database key value in a hash so you don't have to keep querying.) If you don't find the address, insert it, and retrieve the new key (again storing it in the Perl hash if practical). Then proceed to handling the customer data as in the previous case.
HTH
In reply to Re: Perl ODBC question
by VSarkiss
in thread Perl ODBC question
by kendo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |