By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,022 Members | 1,367 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,022 IT Pros & Developers. It's quick & easy.

Problem using COMPUTE with SPROC on ASP Application

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi skirkby:

Are you trying to get totals and subtotals for a grid display?
One example:
http://msdn.microsoft.com/library/de...ta01102002.asp

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Mon, 1 Nov 2004 00:02:05 -0800, "skirkby"
<sk*****@discussions.microsoft.com> wrote:
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


Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.