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

  • Home
  • SEARCH
  • 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 6828563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:23:52+00:00 2026-05-26T22:23:52+00:00

Problem. I regularly receive a feed files from different suppliers. Although the column names

  • 0

Problem.

I regularly receive a feed files from different suppliers. Although the column names are consistent the problem comes when some suppliers send text files with more or less columns in there feed file.

Furthermore the arrangement of these files are inconsistent.

Other than the Dynamic data flow task provided by Cozy Roc is there another way I could import these files. I am not a C# guru but i am driven torwards using a “Script Task” control flow or “Script Component” Data flow task.

Any suggestion, samples or direction will greatly be appreciated.

http://www.cozyroc.com/ssis/data-flow-task

Some forums

http://www.sqlservercentral.com/Forums/Topic525799-148-1.aspx#bm526400

http://www.bidn.com/forums/microsoft-business-intelligence/integration-services/26/dynamic-data-flow

  • 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-26T22:23:53+00:00Added an answer on May 26, 2026 at 10:23 pm

    Off the top of my head, I have a 50% solution for you.

    The problem

    SSIS really cares about meta data so variations in it tend to result in exceptions. DTS was far more forgiving in this sense. That strong need for consistent meta data makes use of the Flat File Source troublesome.

    Query based solution

    If the problem is the component, let’s not use it. What I like about this approach is that conceptually, it’s the same as querying a table-the order of columns does not matter nor does the presence of extra columns matter.

    Variables

    I created 3 variables, all of type string: CurrentFileName, InputFolder and Query.

    • InputFolder is hard wired to the source folder. In my example, it’s C:\ssisdata\Kipreal
    • CurrentFileName is the name of a file. During design time, it was input5columns.csv but that will change at run time.
    • Query is an expression "SELECT col1, col2, col3, col4, col5 FROM " + @[User::CurrentFilename]

    variables window

    Connection manager

    Set up a connection to the input file using the JET OLEDB driver. After creating it as described in the linked article, I renamed it to FileOLEDB and set an expression on the ConnectionManager of "Data Source=" + @[User::InputFolder] + ";Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=\"text;HDR=Yes;FMT=CSVDelimited;\";"

    Control Flow

    My Control Flow looks like a Data flow task nested in a Foreach file enumerator

    control flow

    Foreach File Enumerator

    My Foreach File enumerator is configured to operate on files. I put an expression on the Directory for @[User::InputFolder] Notice that at this point, if the value of that folder needs to change, it’ll correctly be updated in both the Connection Manager and the file enumerator. In “Retrieve file name”, instead of the default “Fully Qualified”, choose “Name and Extension”

    Foreach File Enumerator - Collection tab

    In the Variable Mappings tab, assign the value to our @[User::CurrentFileName] variable

    Foreach File Enumerator - Variable Mappings tab

    At this point, each iteration of the loop will change the value of the @[User::Query to reflect the current file name.

    Data Flow

    This is actually the easiest piece. Use an OLE DB source and wire it as indicated.

    Data flow

    Use the FileOLEDB connection manager and change the Data Access mode to “SQL Command from variable.” Use the @[User::Query] variable in there, click OK and you’re ready to work.
    oledb file source

    Sample data

    I created two sample files input5columns.csv and input7columns.csv All of the columns of 5 are in 7 but 7 has them in a different order (col2 is ordinal position 2 and 6). I negated all the values in 7 to make it readily apparent which file is being operated on.

    col1,col3,col2,col5,col4
    1,3,2,5,4
    1111,3333,2222,5555,4444
    11,33,22,55,44
    111,333,222,555,444
    

    and

    col1,col3,col7,col5,col4,col6,col2
    -1111,-3333,-7777,-5555,-4444,-6666,-2222
    -111,-333,-777,-555,-444,-666,-222
    -1,-3,-7,-5,-4,-6,-2
    -11,-33,-77,-55,-44,-666,-222
    

    Running the package results in these two screen shots

    5 column file 7 column file

    What’s missing

    I don’t know of a way to tell the query based approach that it’s OK if a column doesn’t exist. If there’s a unique key, I suppose you could define your query to have only the columns that must be there and then perform lookups against the file to try and obtain the columns that ought to be there and not fail the lookup if the column doesn’t exist. Pretty kludgey though.

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

Sidebar

Related Questions

I see myself regularly confronted with the following problem. I have some kind of
This is a design problem I face regularly and I'd like to find some
Here is the problem: Agents installed on many different servers send heartbeat signals up
One problem that I come across regularly and yet don't have a solution to
A problem that we need to solve regularly at my workplace is how to
I have a website that is updated regularly and I am having a problem
I have one interesting problem. I must parse mail body (regular expression), get some
A problem I regularly come across writing javascript using jQuery is that when a
I have received some invalid XML data from a poll provider and would like
I regularly get support emails from users who can't download my app from 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.