2
Views
0
Comments
Tip: Sorting on Date/Time values
Discussion
Be careful when sorting on date/time values. If the values were created using CurrDateTime(), they will be accurate to the hundreth of a second, but no more (it is not a true "timestamp" or "ticks" value!).

This surprised me when I was using it to sort records and generate a number based on the "most recent" record. What really happened was that in some cases, records were created so quickly that their "CreatedOn" values were identical, so SQL Server gave me the OLDEST record with the most recent "CreatedOn" value, and my generated number was repeated a number of times.

J.Ja
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.