Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6136005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:32:58+00:00 2026-05-23T17:32:58+00:00

I have denormalized data (coming from a file) that needs to be imported into

  • 0

I have denormalized data (coming from a file) that needs to be imported into parent-child tables. The source data is something like this:

Account#    Name        Membership    Email
101         J Burns     Gold          alpha@foo.com
101         J Burns     Gold          bravo@foo.com
101         J Burns     Gold          charlie@yay.com
227         H Gordon    Silver        red@color.com
350         B Clyde     Silver        italian@food.com
350         B Clyde     Silver        mexican@food.com

What are the pieces, parts, or tactics of SSIS I should use to read the first three columns into a parent table, and the 4th column (Email) into a child table? I have several options for the parent key which I am permitted to take:

  • Directly use the Account# as the primary key
  • Use a surrogate key generated by SSIS during the import process
  • Configure an identity primary key

I’m sure I’ve listed my primary key options in increasing order of difficulty. I’d be interested in knowing how to do the first and the last option – I’ll infer how to achieve the middle option. To emphasize again, I’m interested in a decidedly SSIS solution; I’m looking for an answer that uses the language of SSIS, rather than a procedural, technology neutral answer.

My question is somewhat similar to another SO question, having an answer of vague viability. I’m hoping more detailed guidance could be given. I already know how to solve this problem by creating a “staging” middle-step, where the parent-child separation is actually handled with straight SQL. However, I’m curious about how this can be done without that kind of middle-step.

It seems to me this kind of import would be so common, that there would be a well-published formulaic way to handle it – a technique that SSIS excels at. As yet, I’ve not quite seen any straight up answer to this.

Update #1: Based on comments, I’ve adjusted the sample data to be more obviously denormalized. I also removed “flat” from “flat file,” so that semantics don’t interfere with the question.

Update #2: I’ve amplified my interest in a solution spoken in the language of SSIS.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:32:59+00:00Added an answer on May 23, 2026 at 5:32 pm

    Here is one possible option that you can consider in loading parent-child data. This option consists of two steps. In the first step, read the source file and write data to parent table. In the second step, read the source file again and use lookup transformation to fetch the parent info in order to write data to the child table. Following example uses the data provided in the question. This example was created using SSIS 2008 R2 and SQL Server 2008 database.

    Step-by-Step process:

    1. Create a sample flat file named Source.txt as shown in screenshot #1.

    2. In the SQL database, create two tables named dbo.Parent and dbo.Child using the scripts given under SQL Scripts section. Both the tables have an auto generated identity column.

    3. On the package, place an OLE DB connection to connect to the SQL Server and Flat File connection to read the source file as shown in screenshot #2. Configure the flat file connection as shown in screenshots #3 – #9.

    4. On the Control Flow tab, place two Data Flow Tasks as shown in screenshot #10.

    5. Inside the data flow task named Parent, place a Flat File source, Sort transformation and an OLE DB destination as shown in screenshot #11.

    6. Configure the flat file source as shown in screenshots #12 and #13. We need to read the flat file source.

    7. Configure the sort transformation as shown in screenshot #14. We need to eliminate the duplicate values so that only the unique records are inserted into the parent table dbo.Parent.

    8. Configure the ole db destination as shown in screenshots #15 and #16. We need to insert the data into the parent table dbo.Parent.

    9. Inside the data flow task named Child, place a Flat File source, Lookup transformation and an OLE DB destination as shown in screenshot #17.

    10. Configure the flat file source as shown in screenshots #12 and #13. This configuration is same as the flat file source in the previous data flow task.

    11. Configure the lookup transformation as shown in screenshots #18 and #20. We need to find the parent id from the table dbo.Parent using the other key columns present in the file. The key columns here are the Account, Name and Email. If the file happened to have a unique column, you could just use that column alone to fetch the parent id.

    12. Configure the ole db destination as shown in screenshots #21 and #22. We need to insert the Email column along with the Parent id into the table dbo.Child.

    13. Screenshot #23 shows data in the tables before the package execution.

    14. Screenshots #24 and #25 show sample package execution.

    15. Screenshot #26 shows data in the tables after the package execution.

    Hope that helps.

    SQL Scripts:

    CREATE TABLE [dbo].[Child](
        [ChildId] [int] IDENTITY(1,1) NOT NULL,
        [ParentId] [int] NULL,
        [Email] [varchar](21) NULL,
    CONSTRAINT [PK_Child] PRIMARY KEY CLUSTERED ([ChildId] ASC)) ON [PRIMARY]
    GO
    
    CREATE TABLE [dbo].[Parent](
        [ParentId] [int] IDENTITY(1,1) NOT NULL,
        [Account] [varchar](12) NULL,
        [Name] [varchar](12) NULL,
        [Membership] [varchar](14) NULL,
    CONSTRAINT [PK_Parent] PRIMARY KEY CLUSTERED ([ParentId] ASC)) ON [PRIMARY]
    GO
    

    Screenshot #1:

    1

    Screenshot #2:

    2

    Screenshot #3:

    3

    Screenshot #4:

    4

    Screenshot #5:

    5

    Screenshot #6:

    6

    Screenshot #7:

    7

    Screenshot #8:

    8

    Screenshot #9:

    9

    Screenshot #10:

    10

    Screenshot #11:

    11

    Screenshot #12:

    12

    Screenshot #13:

    13

    Screenshot #14:

    14

    Screenshot #15:

    15

    Screenshot #16:

    16

    Screenshot #17:

    17

    Screenshot #18:

    18

    Screenshot #19:

    19

    Screenshot #20:

    20

    Screenshot #21:

    21

    Screenshot #22:

    22

    Screenshot #23:

    23

    Screenshot #24:

    24

    Screenshot #25:

    25

    Screenshot #26:

    26

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three denormalized tables that I have to take at face value (data
We have a data warehouse with denormalized tables ranging from 500K to 6+ million
I have existing tables that are pretty much denormalized. There are no lookup tables
I have a large table(60 columns, 1.5 million records) of denormalized data in MS
Have a flash player that pops out into a separate popup browser window. And
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the
I have a row of data as follows: header1 header2 header3 header4 header5 row
In reporting tools like Crystal Reports, there are ways to take denormalized data and
Suppose we have a denormalized table with about 80 columns, and grows at the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.