If you work with SQL Server, chances are you’ve used at least one of the CONVERT()
or CAST()
functions to convert from one data type to another. If you’ve ever encountered an error while trying to convert a string to a date/time data type, the PARSE()
function could be what you need.
For example, if you have a string like say, Fri, 20 Jul 2018, the CONVERT()
or CAST()
functions will throw an error. But the PARSE()
function will handle it without a problem.
The PARSE()
function returns the result of an expression, translated to the requested data type in SQL Server. So you can use it to “translate” your string value into a date/time data type (such as date, datetime, datetime2, etc).
Continue reading →