Results 1 to 5 of 5

Thread: Primary Keys

  1. #1
    Join Date
    May 2002
    Location
    Cape Town , South Africa
    Posts
    30

    Unanswered: Primary Keys

    HI ,

    I accidently removed the primary keys from my table by mistake. Is there anyway ,That i can get the PK's back to what is used to be. Need Help pls...... When I try "resetting" the PK I kep getting this error:



    'table_name' table
    - Unable to create index 'PK_tablename'.
    ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]CREATE UNIQUE INDEX terminated because a duplicate key was found for index ID 1. Most significant primary key is '1'.
    [Microsoft][ODBC SQL Server Driver][SQL Server]Could not create constraint. See previous errors.
    [Microsoft][ODBC SQL Server Driver][SQL Server]Warning: The table 'tDetail' has been created but its maximum row size (12521) exceeds the maximum number of bytes per row (8060). INSERT or UPDATE of a row in this table will fail if the resulting row length exceeds 8060 bytes.
    [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated.

  2. #2
    Join Date
    Jul 2002
    Posts
    63
    Before recreating the index you should handle all the rows that do not stand in the index condition (create duplicate- the Error root cause) .

    You should do it by:
    1. delete those rows
    2. group by those rows
    3. change Id of those rows

  3. #3
    Join Date
    May 2002
    Location
    Cape Town , South Africa
    Posts
    30

    Primary Keys

    Thanx for the help..but how do i do that?

  4. #4
    Join Date
    Jul 2002
    Posts
    63
    Thnx for the help....but how do I do that ...do I first delete all duplicates form the server and then re-assign the primary keys?

    Yes !
    1. first delete
    2.re-assign the primary keys

  5. #5
    Join Date
    May 2002
    Location
    Cape Town , South Africa
    Posts
    30
    Originally posted by eschapir
    Thnx for the help....but how do I do that ...do I first delete all duplicates form the server and then re-assign the primary keys?

    Yes !
    1. first delete
    2.re-assign the primary keys


    thanx

Posting Permissions

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