(1) summary of transition function
The low priority data type is automatically converted to the high priority data types, called implicit conversion, when the data type can't automatic conversion, you can use the conversion function converts a data type to another data type, called display conversion,
(2) Cast function
Cast function converts expression by a data type to another data type, the syntax is:
Cast (expression as data_type [(length)])
Among them, expression of any valid expression; Data_type parameters for the target data type, including XML, bigint and sql_variant, cannot use alias data type; Length specifies the length of the target data type of the optional parameters, the default value is 30
(3) the Convert function
The Convert function is similar to the function of the Cast function, the expression of a data type into another data type, the syntax is:
CONVERT (data_type [] (length), the expression [style])
Among them, expression of any valid expression; Data_type parameters for the target data type, including XML, bigint and sql_variant, cannot use alias data type; Length specifies the length of the target data type of the optional integer, the default value is 30; Style specifies how to transform the Convert function expression of integer expression,
CodePudding user response:
Conclusion good is very good