Use expression to get dynamic data in SSIS package (file name with date)

Categories: Database; Tagged with: ; @ November 21st, 2012 18:40

Requirement:


Destination is flat file, and the file name should contains date: YYYYMMDD.

Solution:

Create one variable, stores the dir of the destination file.
Then use Expression to update the connection string of the file destination.

@[User::FileDestrination]  +
"OVERSEAS_USER_INFO_"+
(DT_STR,4,1252) DatePart("yyyy",getdate()) +
Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) + ".txt"

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.