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 |
---|---|
1 | CASTIs used to transform the numerical data into character or string data. |
2 | CONVERTIs used to transform an expression from one data type to another. |
3 | PARSEIs used to convert a string data to the desired data format and returns the outcome as an expression. |
4 | TRY_CASTIs used to return the expression in the chosen data type. |
5 | TRY_CONVERTIs used to change the datatype of an expression. |
6 | TRY_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. |
Leave a Reply