如何从SSIS中的SQL datetime值中仅提取日期? [英] How do I extract just the date from a SQL datetime value in SSIS?

查看:67
本文介绍了如何从SSIS中的SQL datetime值中仅提取日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆