>>declare @t table (Value float null) >>insert into @t >>select >>-41139.99 >>union all select >>10062.99 >>union all select >>1600000 >>union all select >>134979.87 >>union all select >>-154062.04 >>union all select >>-153832.17 >>union all select >>-1235677.922308 >>union all select >>null >> >>select T.value, F.*, F1.*, F2.* from @t T >>cross apply (select CAST(Value as decimal(38,11)) as nValue) F >>cross apply (select CAST(nValue % 1 as varchar(40)) as cValue) F1 >>cross apply (select SUBSTRING(cValue, charindex('.', cValue)+ 1,LEN(cValue)) as Decimals) F3 >>cross apply (select patindex('%[1-9]%',REVERSE(Decimals)) as Non0) F4 >>cross apply (select LEN(Decimals) - (case when Non0 = 0 then LEN(Decimals) else Non0 - 1 end) as DecimalPointPos) F2>>