Sql server 2000

  • i can execute the stored procedure X like this

    exec x

    this procedure returns the 10 rows ,in that rows one column name is empid

    show after execution completed of the procedure X,

    i want sum(empid) value

    how to get it.

  • Return the results of the procedure into a temp table or table variable

  • create procedure y

    as

    create table #tmp( empid int, column int)

    insert into #tmp

    exec x

    select * from #tmp

    select sum(empid) from #tmp

    end

    This will work as long as #tmp has the same definition as the result set as x.

    (also note if you are returning to an application the program will have to go to the next record set after it reaches the first EOF to pull the data from the next select)

    Paul Ross

  • thank u for u r replay

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply