Display sum of Multiple fields from Stored Procedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ArizonaState
    New Member
    • Sep 2007
    • 15

    Display sum of Multiple fields from Stored Procedure

    I have a Stored Proc which outputs the sum of various fields from a table.

    CODE
    ...
    ...
    COMPUTE SUM(Field1), SUM(Field2), SUM(Field3)...
    /CODE
    I am able to execute the SProc and obtain results there, but I would like to display this computed sum in a grid view using the SProc in ASP.

    Whle I am able to display one record based on a selected value or multiple rows matching a selected value by assigning an output variable in the SProc

    (@retVal float output),

    Repeating the problem, I am trying to figure out a way to display the computed sum of different fields where the output is a recordset of one computed value for each selected field.

    Example:
    Field1 contains 1, 2, 3, 4
    Field2 contains 2, 3, 5, 7
    Field3 contains 4, 2, 1, 6
    ...
    .

    Resulting output would be
    Field1: 10 (COMPUTE SUM(Field1))
    Field2: 17 (COMPUTE SUM(Field2))
    Field3: 13 (COMPUTE SUM(Field3))
    ...
    I have not assigned an output variable to the result. Want to know if one output variable in the SProc would handle multiple values (sums of various fields, in this case).

    Help is appreciated!

    Phoenix
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    check out M$'s article: click here . Let me know if this helps.

    Jared

    Comment

    Working...