Advertisement

10.16.2007 at 07:54AM PDT, ID: 22896324
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.8

SSIS Import from flat-file into multiple tables

Asked by AshleyBryant in MS SQL DTS, SQL Server 2005

Tags: , , , ,

I have a massive text file with consultant data for my company that I have to synchronize with records in SQL 2005.  The text file uses ~ as the column delimiter and carriage returns for the row delimiter.  There are no header columns in the text file.  This file has around 180,000 records in it, but I only need about 40,000 of them that meet certain criteria for import.  I'll share all of the fields in the flat file if completely necessary, but in the meantime I'll tell you that it basically has all pertinent info for a person's billing and shipping information (Name, Address, City, State, Zip, Phone, etc.) as well as some internal information such as an ID number, signup dates, and the like.

I only need to pull the records from the flat-file that have all of the following things supplied:  Internal ID, First Name, Last Name, Phone, and Email.  The address information is only partly necessary in the overall scheme of things.

The two tables in the database that I need to import into are a Customer table which holds the necessary info above, and an address table that will hold both of the addresses for that record assuming they are present, but in two separate records.  One record will be for shipping, and the other for billing.

So, here's what has to happen:

For each record that qualifies for import we check and see if a record exists for them in the Customer table.  The fields to match are [Column 1] from the flat file (remember, no headers), and [ConsultantID] in the Customer table.  If they exist, the record is updated with whatever information is in the flat file.  If they don't exist a new record is inserted.  We then do the same thing for the Address table.  The records in the Address table are attached to the Customer table by a FK [CustomerID] which is the PK of the Customer table.

Now, what I've tried so far is to use SSIS to import the flat file into a table in the database and do the synch for just the user data only (no addresses) using a stored procedure.  The problem is that the stored procedure takes over half an hour to run which seems excessive considering the relatively small number of records.  When I throw in the address data as well, the whole process could very well take over an hour.  I don't know if I need to continue down my current path and just accept the fact that it's a long-running operation, or if the whole thing should be done in SSIS (hopefully speeding things up), which I would need your help with.  I'm pretty confident in my abilities with SQL Server overall, but SSIS is still relatively new to me beyond simple imports and exports.

So, let's get started.  Fire away.Start Free Trial
[+][-]10.16.2007 at 09:05AM PDT, ID: 20086698

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.16.2007 at 09:11AM PDT, ID: 20086738

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]10.16.2007 at 10:34AM PDT, ID: 20087397

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.16.2007 at 10:35AM PDT, ID: 20087407

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.16.2007 at 09:45PM PDT, ID: 20090876

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.17.2007 at 01:10AM PDT, ID: 20091536

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL DTS, SQL Server 2005
Tags: ssis, file, import, flat, multiple
Sign Up Now!
Solution Provided By: jogos
Participating Experts: 3
Solution Grade: A
 
 
[+][-]10.17.2007 at 07:51AM PDT, ID: 20093993

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.17.2007 at 08:41AM PDT, ID: 20094486

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.17.2007 at 08:54AM PDT, ID: 20094599

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.17.2007 at 01:36PM PDT, ID: 20096852

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628