Add non-clustered primary key to existing table

  • For a new transactional replication requirement I need to add a primary key to an existing table. The table has 7.5 million rows of 500 bytes. The problem is when I try to add the primary key in EM, all disk space (7.7GB) is used and the process errors out. I have read that creating even a clustered primary key needs only 1.2 times the table space used, which is 4.3GB.

    Am I doing something wrong? Any suggestions on how to create the primary key without filling up the disks?

    Thanks


    Don

    http://www.biadvantage.com

  • If the table does not have any foreign keys, - BCP data OUT by creating a view with TOP 100 PERCENT and ORDER BY the field that you'll use for your PK and using it as the source, truncate the table, create your PK, BCP data back IN.

Viewing 2 posts - 1 through 1 (of 1 total)

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