In SQL Server, between has an error of 30 seconds when querying the date.

Source: Internet
Author: User

In the SQL Server 2005 SP3 environment, we found the following strange phenomenon when we accidentally used between to query date data: paymentdate is smalldatetime

23:59:59 is still outside 0:00:00?

Continue to try and find that the time is reduced31Seconds to achieve the desired effect, as shown below:

Summary:When between is used to limit the time range, the boundary value of the range should be reduced inward.31Seconds to reach the time range that truly meets your needs.

I wonder if this is an "negligible error "?

Supplement:

Later view msdn knowledge :( http://msdn.microsoft.com/zh-cn/library/ms182418.aspx)

The time error of smalldatetime is 1 minute. Values smaller than or equal to 29.998 seconds are rounded down to the nearest minute. values greater than or equal to 29.999 seconds are rounded up to the nearest minute.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.