Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing stored procs in two DBs

Status
Not open for further replies.

Gila47ac

Programmer
Oct 11, 2002
30
US
Using SQL Server 2000...

I would like to compare the contents of user-defined stored procedures in two databases, outputting their names and colid values. The procedures have the same names in the databases. So I tried the obvious coding of:
Code:
SELECT O1.name, C1.colid
    FROM DB1.dbo.sysobjects O1
        INNER JOIN DB1.dbo.syscomments C1
            ON O1.id = C1.id
    WHERE O1.xtype = 'P'
      AND O1.category <> 2
      AND C1.text <>
        (SELECT C2.text
            FROM DB2.dbo.sysobjects O2
                INNER JOIN DB2.dbo.syscomments C2
                    ON O2.id = C2.id
                    AND C2.colid = C1.colid
                    AND O2.name = O1.name
            WHERE O1.xtype = 'P'
              AND O1.category <> 2
        )
;
That resulted in the error message &quot;Server: Msg 8648, Level 17, State 95, Line 1
Could not insert a row larger than the page size into a hash table. Resubmit the query with the ROBUST PLAN hint.&quot;

So I added &quot;OPTION (ROBUST PLAN)&quot;, executed it, and got the error message &quot;Server: Msg 8619, Level 16, State 2, Line 1
Warning: The query processor could not produce a query plan from the optimizer because the total length of all the columns in the GROUP BY or ORDER BY clause exceeds 8000 bytes. Resubmit your query without the ROBUST PLAN hint.&quot;

Suggestions?

(I believe I could get it to work by comparing only one value of colid per query, and doing a UNION of those queries. But that's kludgey, some of the stored procs use colid values up to 15, and could go higher.)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top