简体   繁体   中英

How can I convert a SQL Server date format to Oracle?

I am working on migration of data from an old system to a new system. As part of migration, the data from the legacy system, (stored in files) is pumped into MS SQL Server. Now my app runs on Oracle. I'm having a problem with the date/timestamp.

The timestamp format in MS SQL Server data is:

2008.12.23 00:00:00

Oracle expects:

23/12/2008 00:00:00

or

23-DEC-2008 00:00:00

What would be the best way to import the data? Oracle's to_date() function didn't work as I thought it would.

I assume you're using insert statements?

Convert your dates using:

TO\_DATE(sql\_server\_value,'YYYY.MM.DD HH24:MI:SS')

You can put a second parameter on the to_date function to specify in what format the incoming data is. You will likely have to make SQL server pump the data out as a string.

http://www.techonthenet.com/oracle/functions/to_date.php

使用CONVERT将内部日期时间列转换为您希望在SQL Server端使用的任何格式的文本。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM