牵扯到类型转换使用cast(@d as int/date/timestap)进行转化
try_cast(值AS类型)→类型
与cast()
相似,区别是转换失败返回null
typeof(expr)→varchar
返回提供的表达式的类型的名称:
SELECT typeof(123); -- integer
SELECT typeof('cat'); -- varchar(3)
SELECT typeof(cos(2) + 1.5); -- double
牵扯到类型转换使用cast(@d as int/date/timestap)进行转化
try_cast(值AS类型)→类型
与cast()
相似,区别是转换失败返回null
typeof(expr)→varchar
返回提供的表达式的类型的名称:
SELECT typeof(123); -- integer
SELECT typeof('cat'); -- varchar(3)
SELECT typeof(cos(2) + 1.5); -- double