MSSQL 数据类型转换
语法:
-- CAST Syntax: CAST ( expression AS data_type [ ( length ) ] ) -- CONVERT Syntax: CONVERT ( data_type [ ( length ) ] , expression [ , style ] )
CAST函数:
SELECT CAST(123 as CHAR), CAST('2022-4-19' as datetime)
CONVERT函数:
SELECT CONVERT(CHAR, 123), CONVERT(datetime, '2022-4-19')