February 16, 2009 at 4:26 am
I have a exspression which I use to get the current date including the file name:
"Process completed successfully for " + (DT_STR, 4, 1252) YEAR
( GETDATE()) + "-" + RIGHT("0" + (DT_STR, 2, 1252) MONTH( GETDATE
()), 2) + "-" + RIGHT("0" + (DT_STR, 2, 1252) DAY(GETDATE() ), 2)
How would I change this to get yesterdays date?
i.e. GETDATE() -1
Thanks
February 16, 2009 at 5:41 am
Have you tried replacing every occurrence of GETDATE() by (GETDATE()-1) ?
Derek
February 16, 2009 at 6:16 am
Thanks but that does not work
February 16, 2009 at 6:53 am
How about using DATEADD(d,-1,GETDATE()) ?
Derek
February 16, 2009 at 7:12 am
Nope! :crazy:
February 16, 2009 at 7:34 am
where the heck are you running that script from? I never saw that before!
February 16, 2009 at 7:35 am
This is actually a SSIS expression. You would probably have better luck asking in that forum.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
February 16, 2009 at 7:48 am
Derek Dongray (2/16/2009)
How about using DATEADD(d,-1,GETDATE()) ?
For SSIS, it's DATEADD("d",-1,GETDATE()).
BTW, I tested this with a flat source file (with 1 line in it), a Derived Column Transform (with the OP's original expression, modified with the above, as a new column) and a flat file as destination. It works fine.
Process completed successfully for 2009-02-15
Derek
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply