How do I find the length of characters after a decimal point I have tried using
declare @var float
select @var = 123.345233
select len(ltrim(str(@var,25,3)))
but this always returns 3 why is this?
Printable View
How do I find the length of characters after a decimal point I have tried using
declare @var float
select @var = 123.345233
select len(ltrim(str(@var,25,3)))
but this always returns 3 why is this?
Probably not the best solution but how about using:
ts=CStr(123.456789)
YourResult=Len(ts)-instr(ts,".")
You could make a function ...
* You must have a decimal point in every number otherwise it won't work or you could use one if ....
** Oh and maybe there's a workaround using some function that returns just the part after dec point but I don't remember it :(