通过 SSIS 存储到 Oracle 数据库时日期反转
我通过 SSIS 将日期存储到 oracle 表。
我正在使用执行 SQL 任务, 当我在 SSIS 中查看日期时,它看起来像“01-APR-2008”
但是当它存储在oracle数据库中时,它将其存储为“08-APR-01”,正如您所看到的,日期被颠倒了,我无法控制这里的行为。
任何人都有想法,如果需要,我可以发布整个配置,
执行 SQL 任务具有如下查询:
"INSERT INTO Test.TimeTable (TIME_DIM_ID)
select '"+(DT_STR, 50,1252) @[User::ReadingDate] +"'
from dual"
其中 @User:: ReadingDate 是数据类型 DateTime 的变量,
它的值为 (01-APR-08 9:38:27 PM),这只是默认值,该变量由另一个任务填充,然后变量中的日期由 EXECUTE SQL 任务选取,但它们在存储时是倒置的。
I am storing dates though SSIS to an oracle table.
I am using a Execute SQL Task,
when i view the dates in SSIS it looks like, example '01-APR-2008'
but when it is stored in oracle database, it stores it as '08-APR-01', as you can see the dates are inverted and i have no way controlling the behavior here.
Anyone has an idea, i can post the whole configuration if required,
The Execute SQL task has a query like the one below:
"INSERT INTO Test.TimeTable (TIME_DIM_ID)
select '"+(DT_STR, 50,1252) @[User::ReadingDate] +"'
from dual"
where @User:: ReadingDate is a variable of Data Type DateTime,
and its value is (01-APR-08 9:38:27 PM) this is just the default value, the variable is populated by another task, and the dates in the variable are then picked up by the EXECUTE SQL Task, but they are inverted at the point of storage.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你能显示 sql 任务中使用的查询吗?
如果您知道进入数据库的日期的格式,则应始终适当地对日期进行类型转换。 (我假设输入以字符串形式输入)。
因此,不要使用 '01-APR-2008' ,而是使用 to_date('01-APR-2008', 'DD-MON-YYYY') (不要依赖会话的 NLS 参数)
Can you show the query that is used in the sql task?
If you know the format of the date that is coming into the database, you should always typecast the date appropriately. ( I am assuming the input is coming in as a string).
so instead of '01-APR-2008' , use to_date('01-APR-2008', 'DD-MON-YYYY') (don't rely on the session's NLS Parameters)