问题描述
我正在尝试使用SSIS将数据从chinook db(oracle)移动到chinook DW(mysql).当前在我的oracle数据库中,我具有日期格式(07-AUG-11)并想要,因为我需要输入MYSQL(2011-08-07),但我无法做到这一点.
I am trying to move data from chinook db(oracle) to chinook DW(mysql) using SSIS.Currently in my oracle db I have a date format(07-AUG-11) and want since I need to put in MYSQL(2011-08-07) but I am not able to do it.
我尝试在oracle中使用它进行转换
I tried using this in oracle for conversion
select to_char(to_date(InvoiceDate,'DD-MON-YY'), 'YYYY-MM-DD') from CHINOOK.invoice;
并尝试在SSIS中使用表达式(从to_char开始),但不起作用.(我也尝试过其他表达式,但是SSIS抛出错误,表明该函数不存在)
and tried using the expression(from to_char onwards) in SSIS but did not work.(there are also other expressions I tried but SSIS throws error saying the function does not exist)
我只需要知道SSIS中的表达是什么,如果有人可以帮忙
I just need to know whats the expression in SSIS.If anyone could help
推荐答案
我将使用(在Oracle中)将其作为日期带入SSIS:
I would bring it into SSIS as a date, using (in Oracle):
TO_DATE(InvoiceDate,'DD-MON-YY')
然后,如果您需要将其转换为'yyyy-MM-dd'格式的字符串,则可以使用类似的东西(在SSIS中):
Then if you need to convert it into a string with the 'yyyy-MM-dd' format, you can use something like (in SSIS):
(DT_WSTR, 4) YEAR(DateField) + "-" + RIGHT("0" + (DT_WSTR, 2) MONTH(DateField), 2) + "-" + RIGHT("0" + (DT_WSTR, 2) DAY(DateField), 2)
尽管,如果您的目的地是一个日期字段,那么它应该直接进入而无需任何处理/转换,因为它已经是一个日期了.
Although, if your destination is a date field, then it should go straight in without any processing/transformation as it is a date already.
这篇关于在SSIS中更改日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!