Problem using COMPUTE with SPROC on ASP Application

G

Guest

This will be obvious to some - but not me I'm afraid...

I am using an SQL data link from my ASP application to a SPROC - this all
works fine on standard SELECT statements and JOIN in to a datagrid in my
application. Rather than messing around with the code/server resource, I
thought I would add a COMPUTE line to the bottom of the SPROC to return a
total for one of the columns.

This all works fine in Query Analyser - I have a handle on using output
variables etc. but what is the best way to do this. I do not seem to be able
to get the COMPUTE statement to output to a variable - I get various erros
depending on what I try...

This works in Query Analyser and outputs the COMPUTE statement - how do I
alter this to get the value in to a variable ? The input variables defined
below work fine and this query obviously executes following 2 input
parameters defined by the user viewing the site...

CREATE PROCEDURE SPROC

(
@Date datetime,
@SalesID char
)

AS

SELECT ****Various fields****

FROM ****3 different Databases with pre-defined JOIN****

WHERE (SOR_ORDER_HISTORY.ORDER_DATE = @Date AND
SOR_HISTORY_TRANS.TRAN_SPARE_NUMBER_2 = @SalesID)

ORDER BY SOR_ORDER_HISTORY.THIS_RECORD
COMPUTE SUM(SOR_HISTORY_TRANS.LINE_TOTAL)
GO

Thanks very much for your time
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top