小时和分钟的日期减法(导致浮动)
我希望解决SSIS问题。
我有两列,一列有一个何时开放的日期,另一篇是响应需求时。
我的约会以这种方式出现:
dt_answered_date | dt_created_date |
---|---|
2021-02-04 19:48:00.000 | 2021-02-04 19:44:00.000 |
我想减去DT_ANSWERD_ANSWERD_ENSWERD_DATE_DATE_DATE_DATE minus minus sinus> minus> minus> minus> dt_created_date 但是我希望结果是一个浮点数:
就像在这种情况下,excel中的减法 I get the result:
DT_ANSWERED_DATE | DT_CREATED_DATE | DT_ANSWERED_DATE minus DT_CREATED_DATE |
---|---|---|
2021-02-04 19:48:00.000 | 2021-02-04 19:44:00.000 | 0,00277777777228039 |
I would like to do the same thing but in a derived column at SSIS (Microsoft Visual Studio)
感谢提前的回复
I would like some help with an SSIS problem.
I have two columns, one with a date of when demand was open and another when the demand was responded to.
My date comes in this way:
DT_ANSWERED_DATE | DT_CREATED_DATE |
---|---|
2021-02-04 19:48:00.000 | 2021-02-04 19:44:00.000 |
I would like to subtract DT_ANSWERED_DATE MINUS DT_CREATED_DATE
but I would like the result would be a float number:
like in this case when a subtract in excel
I get the result:
DT_ANSWERED_DATE | DT_CREATED_DATE | DT_ANSWERED_DATE minus DT_CREATED_DATE |
---|---|---|
2021-02-04 19:48:00.000 | 2021-02-04 19:44:00.000 | 0,00277777777228039 |
I would like to do the same thing but in a derived column at SSIS (Microsoft Visual Studio)
Thanks for the response in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您的粒度在几分钟之内。这应该为您提供您要寻找的小数号...
(每小时60分钟 * 24小时)
Microsoft文档... https://learn.microsoft.com/en-en-us/en-us/sql/sql/integration-services/expressions/expressions/expressions /netatediff-sis-expression?view = sql-server-ver16
在上面的示例中,此结果为:
注意:
我强烈建议使用小数与浮子。除非您真的有一个理由。 1 = 1通常在使用浮点数时是不正确的。整数或小数始终是正确的。
It looks like your granularity is in minutes. This should get you the decimal number you are looking for...
(60 min per hour * 24 hours in a day)
Microsoft documentation... https://learn.microsoft.com/en-us/sql/integration-services/expressions/datediff-ssis-expression?view=sql-server-ver16
In your example above this results in:
Note:
I highly recommend using decimal vs float. Unless you really, really have a reason. 1=1 is usually not true when using a float number. It will always be true with integers or decimals.