Adding a timestamp to files in SSIS - SQL School Video

  • Brian Knight

    One Orange Chip

    Points: 27249

    Comments posted to this topic are about the item Adding a timestamp to files in SSIS - SQL School Video

  • SuperDBA-207096

    SSCrazy Eights

    Points: 8176

    Brian,

    Great video! Thanks!

    Mark

  • wildh

    SSCarpal Tunnel

    Points: 4230

    Brian,

    I'm enjoying these videos, and learning some great stuff, keep them up.

    Howard

  • Slabber

    Right there with Babe

    Points: 742

    Warning! Brian does point out that this technique may be no good if the file name needs to be known at a later stage in the package becuase the time will have changed (eg you need FTP or email the file somewhere), but doesn't explain how to fix this. My solution (I'm no expert though, so there might be a better way), is to create a package-level string variable, and at the start of the package use a script to set the value of the variable to be the required path and file name (including the time stamp). This variable can then be used to create the file and then subsequently for an FTP or email (or whatever) task.

    Cheers - Graham

  • wildh

    SSCarpal Tunnel

    Points: 4230

    Brian did show us how to just user the date part for the file name and in most cases that would probably surfice, however, some packages may run into the next day so setting a package variable a the start would be a good idea.

  • Brian Knight

    One Orange Chip

    Points: 27249

    You're right! If the package runs at 11:30PM and then tries to archive the file at 12:30 AM using my expression would fail for the archive, saying it can't find the file. One way around that is to lock in the expression on a variable instead using the EvaluateAsExpression property on the variable then tie that variable to the file name or by using a Script Task.

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

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