Hi,
I'm trying to determine whether the value contained in a numeric field is a whole value or not. I.e. 12.000000 is a whole value, whereas 654.1234000 is not.
I've tried various things but I can't seem to work it out.
I thought that the following function would return 0 if there was no fraction and 1 if there was, but it always returns 0.
create function dbo.iswhole (@n numeric)
returns numeric
begin
return (@n % 1)
end
go
There must be an easy way to do this! I've searched SQL Server and Google, but to no avail.
Any help appreciated
I'm trying to determine whether the value contained in a numeric field is a whole value or not. I.e. 12.000000 is a whole value, whereas 654.1234000 is not.
I've tried various things but I can't seem to work it out.
I thought that the following function would return 0 if there was no fraction and 1 if there was, but it always returns 0.
create function dbo.iswhole (@n numeric)
returns numeric
begin
return (@n % 1)
end
go
There must be an easy way to do this! I've searched SQL Server and Google, but to no avail.
Any help appreciated