Adding a timestamp to my output data

  • I have added a timestamp field to a table fed by an SSIS package. It is datatype 'date'. I added a variable to my SSIS package called 'TodaysDate' and assign the value through the expression '@[System::StartTime]'.

    I'm stuck as to how to get the mapping changed to pass this date during the export of data from a flat file without the date to a SQL Server table needing the date.

    I have a Data Conversion in the Data Flow but I don't see a place for my new field to pickup this variable.

     

     

  • Ok so you have a data flow that uses a flat file as the input and a table (with date column) as the output, is that right?

    If so just drag a Derived Column component into your data flow. You can add the new column here and just drag the variable from the list above into the expression field. Additionally you don't need the variable as you can put that expression directly in the derived column expression as those system variables are also available to use.

    • This reply was modified 3 years, 4 months ago by  TangoVictor.
    Attachments:
    You must be logged in to view attached files.
  • Something really went bad in my VS 2017 SSDT. I went into the advanced editor for the derived column and VS closed, I reopened VS 2017 SSDT and now it says my Solution is incompatible.

  • Gotta love SSIS/VS.

    Can you roll back without loosing too much?

    You could create a new project and add that package into it to see if you can open it. It's hard to say what got corrupt. Might be able to go through the xml and fix the issue there.

    You can try to open the package on it's own by just double clicking the dtsx file. You may need to tell it to use VS. See if that works.

  • Never mind the last crisis... fixed... and the Derived Column with just the expression worked perfectly... thanks!

  • Awesome and yeah you're welcome glad I could help.

  • Why not just give the column a default value in SQL Server? Perhaps you want all of the entries in the batch being process to have the same value.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply