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
 Transact-SQL (2000)
 return float value

Author  Topic 

tedew
Starting Member

22 Posts

Posted - 2005-08-05 : 09:44:59
hello :)

i have a problem with select which should return velue in float type
for example :



Select (3/2)


I get value 1 , but I'd Like float value - 1,5
Is it possible ???

bye
p.s.

sorry for me English :)

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-05 : 09:48:26
Select (3/2.0)


Madhivanan

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

rheitzman
Starting Member

16 Posts

Posted - 2005-08-05 : 13:25:46
If the fields are Int try:

--setup for test
DECLARE @three as Int
DECLARE @two as INT
SELECT @three = 3
SELECT @two = 2

SELECT CAST(@three AS FLOAT)/CAST(@two as FLOAT)
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-06 : 01:06:32

select @three/ cast(@two as float) will do the same

Madhivanan

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

- Advertisement -