将时间 23:59:59.999 添加到结束日期之间 [英] ADD time 23:59:59.999 to end date for between

查看:17
本文介绍了将时间 23:59:59.999 添加到结束日期之间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用以下内容时遇到问题:

I have been having an issue with using the following:

Column_Name BETWEEN @StartDate AND @EndDate. 

这是因为 @EndDate = 00:00:00.000 的时间,它不会获取当天的所有值.

This is because the @EndDate = 00:00:00.000 for the time, which doesn't pick up all the values for that day.

如何将 @EndDate(始终为 00:00:00.000)转换为始终为 Date + 23:59:59.999?

How would I convert the @EndDate (Always 00:00:00.000) to always be Date + 23:59:59.999?

推荐答案

避免需要添加 EndDate + 23:59:59.999 的一个选项是不使用 between 比较,而是使用 column_name >= @StartDate 和 column_name <@EndDate +1

One option that avoids needing to add EndDate + 23:59:59.999 is to not use the between comparison and instead use column_name >= @StartDate and column_name < @EndDate +1

这篇关于将时间 23:59:59.999 添加到结束日期之间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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