Click to See Complete Forum and Search --> : MS SQL returns 0 instead of decimal


tinhtam71
06-20-2007, 01:13 PM
Hi,
Could someone tell me how to show the result in decimal for the following query? I have try cast/convert but none is working, kept getting 0 returns. Thanks.

This is the query
select 13/17

result shows 0 instead of 0.76

Tinhtam

drallab
06-20-2007, 01:26 PM
The default is integer, I believe; just need to specify what format.

select convert(decimal, 13)/convert(decimal, 17)
:)

tinhtam71
06-20-2007, 01:38 PM
It works. Thank you.

tinhtam