End Your If
There are two common functions to convert a string to a date in sql server: the CONVERT() function and CAST() function.
(more…)