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)
 I can't get value to show decimals!!

Author  Topic 

latingntlman
Yak Posting Veteran

96 Posts

Posted - 2006-02-24 : 10:26:47
I have an int field (number of seconds) and I need to get result as
number of seconds divided by 60, but I can't get decimals to show.
i.e. 3367 seconds divided by 60 should show 56.12 if rounded to two decimals, but it shows as 56.00.

I've been using cast and convert but it won't work.

Heeeeeelp!!

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-24 : 10:29:09
select round(3367/60.0,2)


Madhivanan

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

latingntlman
Yak Posting Veteran

96 Posts

Posted - 2006-02-24 : 10:44:48
It worked!! but now it shows six decimal digits and I still want it to display only two.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-24 : 10:47:24
select cast(3367/60.0 as decimal(12,2))


Madhivanan

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

latingntlman
Yak Posting Veteran

96 Posts

Posted - 2006-02-24 : 10:53:38
Thanks, it worked!!
Go to Top of Page
   

- Advertisement -