locked
inserting the flatfile name into a column in a flat file import using SSIS RRS feed

  • Question

  • Hi,

    For tracking purposes, I need to insert the name of the flat file from which data is imported into a column called sourceFile. How can I grab the connection string and get that inserted into a column in the database? (use the Derived Column transformation?)

    Thanks!

     

    Andrew

     

    Friday, August 20, 2010 10:09 PM

All replies

  • why you look for it in connection string?

    didn't you set that file in flat file connection manager in design time? if yes, so you now the exact name of flat file. because this flat file will never change it's name. if name changes so connection manager can not connect to this file.

    and if you set flat file dynamically, probably you use variable for this, so your variable has file name inside. use this variable as file name.

     

    let me know if I'm wrong about your problem


    http://www.rad.pasfu.com
    • Proposed as answer by Todd McDermid Friday, August 20, 2010 11:52 PM
    Friday, August 20, 2010 10:15 PM
  • Reza means yes - use the Derived Column component - he's just questioning why you need to pull apart the connection string.
    Todd McDermid's Blog Talk to me now on
    Friday, August 20, 2010 11:53 PM
  • Hi, I am often loading dozens of flat files and they have different names. Some times, I get busy and lose track of which file I loaded into the staging tables this would help me keep track of which files I have loaded when... And no, these particular files, I am not using a variable and setting the connection string dynamically.

    Monday, August 23, 2010 2:21 PM
  • and tell us how you feed dozen of flat files to the package? with variable names? or what?

    http://www.rad.pasfu.com
    Monday, August 23, 2010 2:34 PM
  • Nope. By changing the connection strings manually.
    Monday, August 23, 2010 3:46 PM
  • Use the FileNameColumnName property of the advanced editor for your flat file source component. Just add the name you would like for your column!

    See Source Custom Properties B.O.L. page.



    Please mark answered posts. Thanks for your time.
    Monday, August 23, 2010 4:10 PM