Friday, March 9, 2012

Decimals

How do I get sql server to display the decimals? None of
these work for example:
select convert(decimal(10,2), 190/90 ) as numberw
select cast((190/90) as float) as numberwHi,
Make one of the numbers a float by adding a dot after it like:
select 190/90.
HTH
Karl Gram
http://www.gramonline.com
"GoTo" <anonymous@.discussions.microsoft.com> wrote in message
news:e13701c40b6d$51d59870$a401280a@.phx.gbl...
> How do I get sql server to display the decimals? None of
> these work for example:
> select convert(decimal(10,2), 190/90 ) as numberw
> select cast((190/90) as float) as numberw|||Convert the numbers first, then do the division:
select convert(decimal(10,2), 190)/90 as numberw
Jacco Schalkwijk
SQL Server MVP
"GoTo" <anonymous@.discussions.microsoft.com> wrote in message
news:e13701c40b6d$51d59870$a401280a@.phx.gbl...
> How do I get sql server to display the decimals? None of
> these work for example:
> select convert(decimal(10,2), 190/90 ) as numberw
> select cast((190/90) as float) as numberw

No comments:

Post a Comment