SSIS 2008 -- in the SEND MAIL TASK >> Expressions>> MessageSource, how do I specify current date?

Hi,

I'm using SSIS 2008 and SQL SERVER 2008R2.

I want to get the current datestamp instead of  @[System::ContainerStartTime]   but I don't know what it's called.

In SSIS, I have a SEND MAIL TASK, then in  EXPRESSIONS, I have set MessageSource to :

        (DT_STR, 100, 1252)  @[System::ContainerStartTime] + " -- " + "Package completed -- SUCCESS"
paultran00Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

brad2575Commented:
You can do this to get date parts and build out your own date format

 (DT_WSTR,4)YEAR(GETDATE()) +  RIGHT("0" + (DT_WSTR,2)MONTH(GETDATE()), 2) + RIGHT("0" + (DT_WSTR,2)DAY( GETDATE()), 2)
0
paultran00Author Commented:
Hi. Thanks for replying.   I also want the time HH:MM:SS and AM or PM  so what would the code look like?
0
brad2575Commented:
(DT_STR, 4, 1252)DATEPART("yyyy", @[System::ContainerStartTime]) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("mm", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("dd", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("hh", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("mi", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("ss", @[System::ContainerStartTime]), 2) +
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

paultran00Author Commented:
How do I get the GETDATE() in this format:  03/23/2018 11:36:19 AM
0
paultran00Author Commented:
I figured it out with your help:

RIGHT("0" + (DT_STR,4,1252)DATEPART( "mm" , getdate() ), 2)  + "/" + RIGHT("0" + (DT_STR,4,1252)DATEPART( "dd" , getdate() ), 2) + "/" + (DT_STR,4,1252)DATEPART( "yyyy" , getdate() )  + " " +(DT_STR,2,1252)DATEPART( "hh" , getdate() ) + ":" +  (DT_STR,2,1252)DATEPART( "mi" , getdate() )  + ":" +  (DT_STR,2,1252)DATEPART( "ss" , getdate() )
 + " -- " + "Package completed -- SUCCESS"

RESULT:

03/23/2018 11:55:48 -- Package completed -- SUCCESS
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
paultran00Author Commented:
Hi, do you know why the 7 minutes is missing the leading 0?  How do I fix it so that it has the leading 0?

RESULT:

03/23/2018 13:7:46 -- Package Completed
0
paultran00Author Commented:
I got it:

RIGHT("0" + (DT_STR,4,1252)DATEPART( "mm" , getdate() ), 2)  + "/" + RIGHT("0" + (DT_STR,4,1252)DATEPART( "dd" , getdate() ), 2) + "/" + (DT_STR,4,1252)DATEPART( "yyyy" , getdate() )  + " " +  RIGHT("0" + (DT_STR,2,1252)DATEPART( "hh" , getdate() ), 2) + ":" +  RIGHT("0" + (DT_STR,2,1252)DATEPART( "mi" , getdate() ), 2)  + ":" +  RIGHT("0" + (DT_STR,2,1252)DATEPART( "ss" , getdate() ), 2)

RESULT:

03/23/2018 13:17:46
0
paultran00Author Commented:
Returns the current datestamp in the format that I wanted.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SQL

From novice to tech pro — start learning today.