[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

rodchar

3/20/2007 1:09:00 PM

hey all,
i have a query with 2 variables that i'm trying to divide to get a
percentage. for example, i'm trying 1 / 4 to get 0.25 but all i'm getting is
0.00. do i need to open an incident with microsoft?

thanks,
rodchar
3 Answers

bob

3/20/2007 1:17:00 PM

0

1.0 / 4 will give you 0.25. You are trying to divide an integer.

"rodchar" <rodchar@discussions.microsoft.com> wrote in message
news:82C7FEB8-B039-431A-85D3-287499EAD199@microsoft.com...
> hey all,
> i have a query with 2 variables that i'm trying to divide to get a
> percentage. for example, i'm trying 1 / 4 to get 0.25 but all i'm getting
> is
> 0.00. do i need to open an incident with microsoft?
>
> thanks,
> rodchar


rodchar

3/20/2007 1:26:00 PM

0

ok, i guess i'll cancel the incident. thanks bob o (you ever watch "scrubs"
on tv).
rod.

"bob" wrote:

> 1.0 / 4 will give you 0.25. You are trying to divide an integer.
>
> "rodchar" <rodchar@discussions.microsoft.com> wrote in message
> news:82C7FEB8-B039-431A-85D3-287499EAD199@microsoft.com...
> > hey all,
> > i have a query with 2 variables that i'm trying to divide to get a
> > percentage. for example, i'm trying 1 / 4 to get 0.25 but all i'm getting
> > is
> > 0.00. do i need to open an incident with microsoft?
> >
> > thanks,
> > rodchar
>
>
>

Hari

3/20/2007 2:19:00 PM

0

Hello,

This is because SQL Server treat this as integer data type and round of the
result. So make use of Numeric data type. Try the below sample:-

SELECT 1/4.0

Thanks
Hari

"rodchar" <rodchar@discussions.microsoft.com> wrote in message
news:82C7FEB8-B039-431A-85D3-287499EAD199@microsoft.com...
> hey all,
> i have a query with 2 variables that i'm trying to divide to get a
> percentage. for example, i'm trying 1 / 4 to get 0.25 but all i'm getting
> is
> 0.00. do i need to open an incident with microsoft?
>
> thanks,
> rodchar