cast和convert用于数据类型转换,round用于四舍五入取近似字,numeric用于精确设置数字精度(长度)和小数位数。
T-SQL:
CAST and CONVERT
Explicitly converts an expression of one data type to another. CAST and CONVERT provide similar functionality.
Syntax
Using CAST:
CAST ( expression AS data_type)
Using CONVERT:
CONVERT ( data_type [ ( length) ] , expression [ ,style ] )
Arguments
expression
Is any valid Microsoft® SQL Server™ expression. For more information, seeExpressions.
data_type
Is the target system-supplied data type, including bigint andsql_variant. User-defined data types cannot be used. For more information about available data types, seeData Types.