ALTER FUNCTION [dbo].[ClearRestZero](@val numeric(18,8))
RETURNS varchar(20)
AS
begin
return
case
when @val=cast(@val as int)
then ltrim(cast(@val as int))
else
left(@val,len(@val)-patindex('%[^0]%.%',reverse(@val))+1)
end
end
08-18
8043
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)