CAST 和 CONVERT
convert(目标类型,要转换的数字);
cast(要转换的数字 as 目标类型);
如:
declare @score float;
set @score=1.6;
select convert(varchar(5),@score);
declare @score float;
set @score=1.6;
select cast(@score as varchar(5));
时间: 2024-11-07 17:02:34
convert(目标类型,要转换的数字);
cast(要转换的数字 as 目标类型);
如:
declare @score float;
set @score=1.6;
select convert(varchar(5),@score);
declare @score float;
set @score=1.6;
select cast(@score as varchar(5));