Decimal places not returning from a stored procedure

I have a stored procedure which should be returning a percentage back to the ASP page.

The problem is it is rounding up to the nearest whole number and not returning the decimal places.

The relevant parts of the stored procedure are as follows(the variable used to return the percentage is @result4):

CREATE PROCEDURE sp_highlevelsummaryrpt

@result4 int output
declare @discinc decimal

if (@discinc is null)
          set @discinc = '0'

set @discinc = (select Approved_Disc_Inc from pr_misc)

set @result4 = @discinc
select @result4

In the ASP page, I am showing the variable on the page as follows:

result4 = cmd_Execute_stored_procedure.Parameters("@result4")


I have tried changing the data type in the stored to float, numeric but none work.

Can anyone help??
Who is Participating?

Improve company productivity with a Business Account.Sign Up

John844Connect With a Mentor Commented:
whenyou tried changing the datatype as mentioned above, did you also change the datatype of your command parameter?
you have declared your output variable (@result4) as an integer, therefore you will not get any decimalplaces returned.

try this: @return4 numeric(13,10)
I meant @result4 off course, sorry...
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

obichamAuthor Commented:
That's a very good point but unfortunately it still doesn't work for some reason.

I tried declaring the output variable as decimal and a float but that won't work either
set @discinc = (select Approved_Disc_Inc from pr_misc)

what type of field is Approved_Disc_Inc? And what does it contain?
obichamAuthor Commented:
It is decimal(5) and it contains the value 1.75
select Approved_Disc_Inc from pr_misc

does this return a single value? or multiple records? can you post more of your stored procedure?
does the stored procedure display the proper values when you run it from query analyser?

I would also change this line to avoid any future problems if more records are added.
set @discinc = (select Approved_Disc_Inc from pr_misc)
set @discinc = (select TOP 1 Approved_Disc_Inc from pr_misc)
obichamAuthor Commented:
This is indeed where I was going wrong.

Thanks very much.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.