If you read this blog on a regular basis, you probably know that a frequently covered topic is dates and times and the use of the DateTime data type
. Well, along those same lines, my latest article has just been published over at SQL Team: Working with Time Spans and Durations in SQL Server
From the Article:
What is the best way to return the "duration" of an event in SQL, given the start and end datetime values? How can we add up these durations to return grand totals? What data types should be used to return this data to our clients? How do we handle overflows, such as when hours go over 23 or minutes total up to over 59? Are there any T-SQL functions or other techniques that are useful in these scenarios?
It is mostly targeted towards beginner SQL programmers, but even experienced programmers may find some of the ideas and tips useful.