Conversion Functions

In SQL, the conversion functions are used to convert a value from one datatype to another. Generally, the form of the function names follows the convention datatype TO datatype. The first datatype is the input datatype. The second datatype is the output datatype.

List of Functions

Following is a list of functions available in the SQL server for Conversion of one datatype to another −

Sr.No.Function & Description
1CASTIs used to transform the numerical data into character or string data.
2CONVERTIs used to transform an expression from one data type to another.
3PARSEIs used to convert a string data to the desired data format and returns the outcome as an expression.
4TRY_CASTIs used to return the expression in the chosen data type.
5TRY_CONVERTIs used to change the datatype of an expression.
6TRY_PARSEIs used to return a result of an expression that has been converted to the specified data type, or NULL if the conversion is unsuccessful.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *