I am trying to run a query inside a package in sql transformation. tryo to convert the datetime to string where i have the value 2019-05-02 12:00:00 AM to 2019-05-02
*
FROM <MyTable> where datekey ='" + (DT_STR,20,1252)(@[User::NextStartTime]) + "'
I tried this but it gives an output as datekey = '12:00:00 AM' but i am looking for '2019-05-02'
You can simply use the following expression:
LEFT((DT_WSTR,50)@[User::NextStartTime],10)
Output:
2019-05-10
Based on the Cast (SSIS Expression) official documentation:
When a string is cast to a DT_DATE, or vice versa, the locale of the transformation is used. However, the date is in the ISO format of YYYY-MM-DD, regardless of whether the locale preference uses the ISO format.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With