如何从SSIS中的SQL datetime值中仅提取日期? [英] How do I extract just the date from a SQL datetime value in SSIS?
问题描述
如何在SSIS中将日期时间转换为仅一个日期?
How do I convert a datetime to just a date in SSIS?
我正在尝试执行一个汇总查询,该查询将按特定日期分组.为此,我试图仅提取时间戳的日期部分(存储为datetime),以便在下一步中执行GROUP BY.
I'm trying to perform an aggregate query which will group by a particular date. In order to do that, I'm trying to extract just the date portion of the timestamp(stored as a datetime) so I can perform the GROUP BY on the next step.
我已经看过DATEPART函数,但是看起来我必须多次调用它才能检索月,日和年,将它们连接在一起,然后解析新日期.必须有一个更好的方法来做到这一点.
I've looked at the DATEPART function, but it looks like I would have to call it multiple times to retrieve the month, date and year, concatenate them together and then parse the new date. There has got to be a better way to do this.
推荐答案
在 SSIS 中,您可以使用数据转换转换,对于输入值,您具有 DT_DBTIMESTAMP
,并使用 DT_DBDATE
In SSIS you can use Data Conversion Transformation, for input value you have DT_DBTIMESTAMP
and for output use DT_DBDATE
这篇关于如何从SSIS中的SQL datetime值中仅提取日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!