February 19, 2003 07:19 PM

When Datetime Data Types Behave Strangely

Rating: (0)
SQL Server Magazine
InstantDoc ID #37713

I'm having difficulty troubleshooting strange behavior of datetime values. SQL Server is incorrectly including rows in or excluding them from result sets when the date range is within a few milliseconds of my target threshold. Why is this happening?

A Few people know exactly how datetime values work in SQL Server. If you aren't one of the few, your T-SQL calculations based on datetime values could be wrong. Let's use an imaginary table called OrderDateTest to explore datetime behavior. Listing 1 shows a script that builds and populates OrderDateTest with some test records.

Let...

...This article is for paid Professional Members only.

Already a Professional Member? Please log in now:

NOT A PROFESSIONAL MEMBER? YOU CHOOSE:

Professional Membership

Monthly

Annual

VIP Membership

Monthly

Annual

Add a Comment

There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here