1: CAST method
CAST (expression of any valid data type to convert again AS [length data types, optional])
例:SELECT CAST(10000 as varchar(10))
SELECT CAST(10000 as varchar)
2: Convert method
Convert (to convert the data type of [the length of data types, optional], any valid expression [, its display style, optional])
例:SELECT CONVERT(datetime,'2017-01-01')
SELECT CONVERT(varchar, CONVERT(datetime,'2017-01-01'),104)
CAST is the difference Convert and the conversion can be specified style
3: Implicit Data Type Conversion
Example: the SELECT CAST (AS 10000 Money) * CAST (10 AS
int) ----------------
Disclaimer: This article is CSDN blogger "tj146780 'original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/weixin_39462109/article/details/79294163