Insert Output Store Into Table?

  • Tsup Gente!

    The output of my store has 2 tables, how can I insert these 2 tables into another 2 temp tables to manipulate the data? I use this store into other store, of course.

    Is there a way to do it?

    Thnks!

  • dacto77 (2/5/2009)


    Tsup Gente!

    The output of my store has 2 tables, how can I insert these 2 tables into another 2 temp tables to manipulate the data? I use this store into other store, of course.

    Is there a way to do it?

    Thnks!

    SELECT...

    INTO #NewTable

    Check out the Books Online for details

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Do you want all of the entries from these two tables or just new entries. If you want all of the entries like Grant says just use select into, if you just want new entries you can either use triggers on the 2 existing tables or you could use Insert Output statements

    Hope this helps

    Andy

  • Well, searching for a while I found this:

    CREATE TABLE #tmp

    (col1 INT,

    col2 VARCHAR(50),

    col3 VARCHAR(255))

    INSERT #tmp

    EXEC dbo.MyStore

    but the problem is that my store returns 2 tables,

    how can I avoid the second table that returns the store?

    or how can I capture this 2nd table into a dummy table?

    of course the store is old and used into other process but I need one of its output tables.

    thnks men!

  • It was really not obvious what 'My store' was at just then - unless I'm being dense 🙂

  • Presumably you're calling the sp MyStore from more than one place - so how about an extra parameter StoreInTables - set a default on this of 0 and if it's passed in as a 1 do the inserts in the sp

Viewing 6 posts - 1 through 5 (of 5 total)

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