代码
declare @bl decimal(10,6),
@str char(20),@T char(20),
@str2 char(20),@str3 char(20),@zx1 int
set @bl=1110.3720000
set @T=rtrim(ltrim(REVERSE(@bl)))
set @zx1=cast(@bl as int)
set @str2=cast(@zx1 as char(10))
set @zx1=cast(cast(@T as decimal(10,6)) as int)
set @str3=ltrim(REVERSE(cast(@zx1 as char(10))))
if @str3=0
set @str=rtrim(cast(@str2 as char(20)))
else
set @str=rtrim(cast(@str2 as char(20)))+'.'+rtrim(cast(@str3 as char(6)))
print @str
@str char(20),@T char(20),
@str2 char(20),@str3 char(20),@zx1 int
set @bl=1110.3720000
set @T=rtrim(ltrim(REVERSE(@bl)))
set @zx1=cast(@bl as int)
set @str2=cast(@zx1 as char(10))
set @zx1=cast(cast(@T as decimal(10,6)) as int)
set @str3=ltrim(REVERSE(cast(@zx1 as char(10))))
if @str3=0
set @str=rtrim(cast(@str2 as char(20)))
else
set @str=rtrim(cast(@str2 as char(20)))+'.'+rtrim(cast(@str3 as char(6)))
print @str