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 2005 Forums
 Transact-SQL (2005)
 How to use precesion here

Author  Topic 

satish.gorijala
Posting Yak Master

182 Posts

Posted - 2009-07-08 : 10:14:06
Select (Convert(decimal,31)/62)*100

i am getting result as 50.00000. If i want to consider only 50.00 or 50.0 . How can i write a query?


G. Satish

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-07-08 : 10:16:21

Select cast((Convert(decimal,31)/62)*100 as decimal(12,2))

Select cast((Convert(decimal,31)/62)*100 as decimal(12,1))

Madhivanan

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

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2009-07-08 : 10:20:47
Select Cast((31*1.0/62)*100 as decimal(12,2))
Select Cast((31*1.0/62)*100 as decimal(12,1))
Go to Top of Page

satish.gorijala
Posting Yak Master

182 Posts

Posted - 2009-07-08 : 10:38:11
Thank you.

quote:
Originally posted by madhivanan


Select cast((Convert(decimal,31)/62)*100 as decimal(12,2))

Select cast((Convert(decimal,31)/62)*100 as decimal(12,1))

Madhivanan

Failing to plan is Planning to fail



G. Satish
Go to Top of Page
   

- Advertisement -