The impetus behind this function is that lately I’ve been asked by couple of fellow developers about a way to find out difference between two datetime values in hh:mm:ss format.The function below will give you time difference between two datetime…
Sparse Columns and Column Sets in SQL 2008
A common scenario which I have come across many times in my projects is the case where we need to design a table to store the attributes related to an entity especially when the number of attributes are large and…
Using “quirky” updates to develop well performing set based solutions
This blog is to illustrate a scenario where ‘quirky’ update can be used efficiently to provide an optimized set based solution. Recently I was asked by one of guys in a forum to provide an optimized solution for the below…
Convert hexadecimal values stored in string to integer equivalent
There have been a few occasions which I have come across where its required to convert hexadecimal value stored in string value to integer. In such cases a simple cast or convert wont work.Even converting to intermediate varbinary will also…
Calculating business hours
This is a function modified from my earlier blog http://visakhm.blogspot.com/2010/02/generating-calendar-table.html The below function basically calculates the total business hours elapsed between two date periods taking into consideration business start and end times. It also assumes that there’s an existing table…