2015-04-11

TSQL - Function to remove trailing zeros

ALTER function [dbo].[getNoTrailingZeroes]( @text varchar(max))
returns varchar(max)
as
begin
       return(
              reverse(
                     substring(reverse(@text), patindex('%[^0]%',reverse(@text)), 8000)
              )
       );
end;


No comments:

Post a Comment