PARSE () function is Introduced at MS SQL Server 2012. Here in this article we are trying to illustrate the PARSE () function.
Why the PARSE ()
The PARSE () function is used to convert staring value to Numeric or Date/Time format. Please remember that PARSE () function can convert only string value. If the string value cannot converted to Numeric or Date/Time format it will provide an Error.
What it needs
PARSE () function needs common language run time (CLR) to convert sting value to Numeric or Date/Time format. If the CLR is not installed the PARSE () returns an Error.
To install CLR use
Syntax of PARSE ()
PARSE ( string_value As data_type [Using culture])
String_value - The expression which needs to be parsed.
Data_type - To which data type we are converting to.
CULTUre - To which culture, i.e., language such as gb-en, us-en. This is an optional parameter.
Culture part of the function is optional. Language like English, Japanese, Spanish, Danish, French etc. to be used by MS SQL Server to interpret data. If the culture is not specified the culture of the current session is used. The culture can be any of the .NET supported cultures.
Example of PARSE ()
Hope you like it.
Posted by: MR. JOYDEEP DAS