SQL Server 7.0 upgrade might fail if SQL Server 6.5 databases have more than 32,000 tables (260344)



The information in this article applies to:

  • Microsoft SQL Server 7.0
  • Microsoft SQL Server 6.5

This article was previously published under Q260344
BUG #: 57850 (SQLBUG_70)

SYMPTOMS

When you use the Microsoft SQL Server 7.0 Upgrade Wizard to upgrade a Microsoft SQL Server 6.5 database that has more than 32,000 tables, the upgrade might fail with the following error message:
Error #457
This Key is already associated with an element of this collection.

WORKAROUND

Use Data Transformation Services (DTS) and select a subset of tables at a time to transfer the data from SQL Server 6.5 to SQL Server 7.0.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0.

MORE INFORMATION

To reproduce the error message, follow these steps:
  1. In SQL Server 6.5 create a new database with a database device of 1 GB in size and a log device of 512 MB in size.

    For example:
    Create Database upgrade_repro
    On Device1 = 1024
    Log On Device2 = 512
    					
  2. Create 33,000 tables in the database upgrade_repro. You can create a stored procedure to automate the creation of these tables. For example:
    CREATE PROCEDURE create_tables(@tables int)
    AS 
    declare @i int, @str VARCHAR(100)
    SELECT @i = 0
    while ( @i < @tables )
    BEGIN
    SELECT @str = 'CREATE TABLE tab' + convert(char(6), @i) + '(c1 int, c2 char)'
    PRINT @str
    EXEC(@str)
    SELECT @i = @i + 1
    END
    GO
    
    exec create_tables 33000
    					
  3. Select the Upgrade Wizard and follow all the instructions the wizard presents you.
  4. When you reach the Upgrade Wizard screen that prompts you to choose the database to upgrade, choose the database you created in step 1.
  5. When you click the Next button in the Upgrade Wizard screen another screen opens that contains the error message described in the "Symptoms" section of this article.

Modification Type:MajorLast Reviewed:12/17/2004
Keywords:kbBug kbCodeSnippet kbpending KB260344