Microsoft SQL Server 2005 Inserting into tables from child procedure which returned multiple tables

Posted by Kevin on Stack Overflow See other posts from Stack Overflow or by Kevin
Published on 2010-04-16T14:32:32Z Indexed on 2010/04/16 14:53 UTC
Read the original article Hit count: 550

I've got a child procedure which returns more than table.

child:

PROCEDURE KevinGetTwoTables
AS BEGIN
    SELECT 'ABC' Alpha, '123' Numeric

    SELECT 'BBB' Alpha, '123' Numeric1, '555' Numeric2
END

example:

PROCEDURE KevinTesting
AS BEGIN
    DECLARE @Table1 TABLE (
        Alpha varchar(50),
        Numeric1 int
    )
    DECLARE @Table2 TABLE (
        Alpha varchar(50),
        Numeric1 int,
        Numeric2 int
    )

    --INSERT INTO @Table1
    EXEC KevinGetTwoTables
END

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about stored-procedures