我正在尝试在 sql 转换中的包内运行查询。尝试将日期时间转换为字符串,其中我的值为 2019-05-02 12:00:00 AM 到 2019-05-02
*
FROM <MyTable> where datekey ='" + (DT_STR,20,1252)(@[User::NextStartTime]) + "'
我尝试了这个,但它给出的输出为 datekey = '12:00:00 AM' 但我正在寻找 '2019-05-02'
最佳答案
您可以简单地使用以下表达式:
LEFT((DT_WSTR,50)@[User::NextStartTime],10)
输出:
2019-05-10
基于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.
关于sql - 将日期时间转换为日期字符串 2019-05-02 12 :00:00 to 2019-05-02,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56067166/