如何将datetime2作为datetime [英] how to cast datetime2 as datetime
问题描述
我正在尝试将datetime2转换为datetime,以便仅使用SQL或SSIS在不同的源之间创建标准
以下列SQL查询为例:
I'm trying to convert datetime2 to datetime in order to create a standard between different sources using only SQL or SSIS Take the following SQL query as example:
SELECT CAST(offer_start_date AS datetime)
FROM [ODS].[macaclient_offers]
我收到以下错误:
'不允许从数据类型datetime2到时间戳的显式转换'
I get the following error: 'Explicit conversion from data type datetime2 to timestamp is not allowed.'
此外我使用一个简单的转换成功将datetime2转换成日期。
Furthermore, I did managed to convert datetime2 into date using a simple cast.
使用SQL Server 2008或SSIS将datetime2转换为datetime的正确方法是什么?
What is the right way to convert datetime2 to datetime using SQL Server 2008 or SSIS?
gilibi
推荐答案
好的,我设法使用SSIS数据转换组件。
我发现我可以使用DT_DBTIME2或DT_DBTIME
OK, I managed to accomplish that using a SSIS data conversion component. I found out that I can use either DT_DBTIME2 or DT_DBTIME
感谢所有帮助
这篇关于如何将datetime2作为datetime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!