We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Expression in SSIS package for file name

sqlcurious
sqlcurious asked
on
Medium Priority
448 Views
Last Modified: 2012-05-11
Hi,
I need to automate the package such that it will pick the file for yesterday from the below location
X:\Marketing\MetroWeb\MET1D_SERIAL_DAILY_RTN_041311.txt
I am trying to change the given expression :
"/MET1D_SERIAL_DAILY_RTN_"+(DT_WSTR, 8)  ( (DT_I4) ( (DT_WSTR, 4) YEAR( GETDATE()  )  +
             Right("0"+ (DT_WSTR, 2) MONTH( GETDATE() ) ,2) +
             Right("0"+ (DT_WSTR, 2) DAY( GETDATE()  ) ,2) ) - 1 ) + ".txt"
which gives MET1D_SERIAL_DAILY_RTN_20110413
I am trying to modify and it is not working, please help
Thanks
Comment
Watch Question

Sr. BI  Developer
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Jason YousefSr. BI  Developer

Commented:
I've it in my blog by the way, please consider following :)

http://asqlb.blogspot.com/2010/11/ssis-get-date-with-leading-zeros.html
Alpesh PatelSolution Architect at TCS (SAFe®Agilist, TOGAF® Foundation, PSM I®, MCP, MCSD)
CERTIFIED EXPERT

Commented:
"\\\\" +  @[User::FILE_SHARE] + TRIM(@[User::Done]) + LTRIM(@[User::FileName]) + RIGHT("0" + (DT_WSTR,2)MONTH(GETDATE()), 2)  + RIGHT("0" + (DT_WSTR,2)DAY( GETDATE()), 2) +  RIGHT((DT_WSTR,4)YEAR(GETDATE()),2) +   ".txt"

Author

Commented:
thnks!
Jason YousefSr. BI  Developer

Commented:
Thanks for the grade and the points :)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.