Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 is it simple integer value ?

Author  Topic 

noamg
Posting Yak Master

215 Posts

Posted - 2006-05-29 : 10:49:04

how to know if an expresion's result is a simple integer value or has any value after the float point ?

for example:
SET @c = Sqrt( @a / @b )
Is @c has something after the float point or maybe it is a nice integer ?
any idea ?

Noam Graizer

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-29 : 10:51:50
It depends on the datatype of @c



Declare @a int, @b int, @c float
select @a=10, @b=5
SET @c = Sqrt( @a / @b )
select @c
Go

Declare @a int, @b int, @c int
select @a=10, @b=5
SET @c = Sqrt( @a / @b )
select @c

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

noamg
Posting Yak Master

215 Posts

Posted - 2006-05-29 : 10:53:07
declare @c decimal(28,10)
how to know if @c includes some value after the point ?


Noam Graizer
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-29 : 10:59:02
[code]if ceiling(@c)= floor(@c)
Print 'Integer'
else
Print 'Non integer'[/code]

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

noamg
Posting Yak Master

215 Posts

Posted - 2006-05-29 : 11:03:47
GREAT !
thanks, i didn't think ...

Noam Graizer
Go to Top of Page
   

- Advertisement -