Truncating SQL DateTime in SQL Server 2008
Recently a coworker was writing a T-SQL script to compare ten-minute timeslices against each other. He was trying to figure out an easy, performant way to remove the ones place so that he could treat all timeslices from 01:00.00 to 01:09.99 as the same datetime, and so on. I found a few StackOverflow resources like this one but none that did exactly what I wanted. I adapted those with some trial and error into this:
1 2 3 4 |
|