James123
James123

Reputation: 11652

How to change return results fields names when called SP in SQL?

I am going call Stored procedure in another stored procedure. But I want change results return fields names to different. How can I change them?

ALTER PROCEDURE [dbo].[proc_GetMembership]  
    @id varchar(50)
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

        exec sp_Membership @id
END

When I called exec sp_Membership @id I will get below fields names. I want to change them

product_code    rate_structure  line_status_code    cycle_begin_date    cycle_end_date  initial_begin_date
PROFESSIONAL    1CATO30         P                   2012-01-01         2012-12-31       1994-08-01 

Upvotes: 1

Views: 59

Answers (1)

gbn
gbn

Reputation: 432180

You'll have to load pre-created temporary table

..

CREATE TABLE #foo  (..)

INSERT #foo
exec sp_Membership @id

SELECT * FROM #foo

...

Or modify sp_Membership

Or handle it in the client code

Upvotes: 2

Related Questions