Developing Matt

My Technical Journal

SSIS file name with time

leave a comment »

There is often a need to add a time stamp on your file.  On your file connection (in connection manager section of ssis) pull up the properties for your file (F4 or right click…properties).  Expand expressions and add in a new expression of ‘Connection String.”  From there you should be able to get to your expression builder.  This uses regular expressions. 

From there add your file location, file name and then you can add the parts of your dates with

(DT_WSTR,20) DATEPART("Hh", GETDATE())  +"_" +  (DT_WSTR,20)DATEPART("n", GETDATE()) +"_" +  (DT_WSTR,20)DATEPART("s", GETDATE()) +".txt"


DT_WSTR is the casting function and DATEPART pulls out the part of your date.

Result: 8_23_31.txt


Written by matt

August 17, 2012 at 7:24 am

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: