简体   繁体   English

如何将SQL Server日期格式转换为Oracle?

[英]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. 作为迁移的一部分,来自旧系统的数据(存储在文件中)将被泵送到MS SQL Server中。 Now my app runs on Oracle. 现在,我的应用程序在Oracle上运行。 I'm having a problem with the date/timestamp. 我的日期/时间戳有问题。

The timestamp format in MS SQL Server data is: MS SQL Server数据中的时间戳格式为:

2008.12.23 00:00:00 2008.12.23 00:00:00

Oracle expects: Oracle期望:

23/12/2008 00:00:00 23/12/2008 00:00:00

or 要么

23-DEC-2008 00:00:00 2008年12月23日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. Oracle的to_date()函数无法正常运行。

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. 您可以在to_date函数上放置第二个参数,以指定传入数据的格式。 You will likely have to make SQL server pump the data out as a string. 您可能必须使SQL Server将数据作为字符串泵出。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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