SQL divisions

9,725 pts.
Tags:
SQL
SQL Calculations
Hi All, I'm trying to make a calculation through SQL code but this is resulting in a 0. Example: declare @activities as integer declare @days as integer declare @media as float --my queries that extracts data and sets values to @days, @activities; in this case they return @activities=51 and @days=199 set @media = @activities/@days select @days as Days,@activities as Acts, @media as Media and this results in Days - Acts - Media 199 51 0 Why this result, instead of 0,25628140703517587939698492462312 ?
ASKED: January 28, 2009  3:43 PM
UPDATED: January 28, 2009  3:50 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

I found the solution by myself by simply changing the:
<pre>declare @activities as integer
declare @days as integer
declare @media as float </pre>

to
<pre>declare @activities as float
declare @days as float
declare @media as float </pre>

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • alessandro.panzetta
    Thanks for posting the solution Sean Community Manager
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following