I have a number of type Decimal(8, 2)
and have been using Substring
to get fractional value.
E.g.)
declare @val decimal(8, 2), @strVal varchar(10)
set @val = 15.80
set @strVal = cast(@val as varchar)
select @val, substring(@strVal, charindex('.', @strVal), len(@strVal))
Is there a better way to simply get fractional value, .80
from @val
without having to convert it to a character?
I am wondering if there is a built-in UDF (User-Defined Function) that would parse instead of having to rolling out my own version.