Results 1 to 2 of 2

Thread: How to put stored procedure result to a tale?

  1. #1
    Stephen Loo Guest

    How to put stored procedure result to a tale?

    As subject. I want to put dbcc result to a temp table.

    How to do it?

    Thank you.

    Stephen Loo

  2. #2
    Jasper Guest

    How to put stored procedure result to a tale? (reply)

    On 9/21/98 2:50:51 AM, Stephen Loo wrote:
    > I want to put dbcc result to a temp table.

    I have a SP that executes various SPs on some tables. This `driving` SP checks for indexes on all associated tables, before execution. If all tables have an index then it completes the execution of all SPs.

    The same method can be used to hold DBCC command outputs - just put the DBCC in EXEC (`DBCC ... `)

    -- Create Temporary Table for Storing sp_helpindex output
    CREATE TABLE #Index (
    name varchar(25),
    dscr varchar(55),
    keys varchar(255)
    )

    -- Dump Output to Temp Table
    INSERT INTO #Index EXEC (`sp_helpindex TBL_DFD14_COSTS`)
    SELECT @COUNT = COUNT(1) FROM #Index
    IF @COUNT = 0
    SELECT @INDEX = `TBL_DFD14_COSTS`
    TRUNCATE TABLE #Index

    The SP checks variable @INDEX, if not Null then stop.

    You will have to examine the output of the DBCC and create a destination table with an appropriate schema. Once the SP has executed it automatically drops the Temp table.

    Jasper

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •