Access Key Violation in Index aaaaaPk.... 
Author Message
 Access Key Violation in Index aaaaaPk....
Hi,

I've come accrrosed an odd situation in sql server 6.5 where i have a table
named tb_order and the primary key for that table is order_id (identity seed
1). When i tried to insert a record in that table the mesage get is the
primary key violation. But it's a identity column and there wasn't any
duplicate key data.

I had to drop the table and create it again to get it working.

DO have any idea why it might occur?



Sun, 25 Nov 2001 03:00:00 GMT
 Access Key Violation in Index aaaaaPk....

If the server is unexpectedly shut down, the last Identity value used and
what SQL Server "Thinks" is the last Identity used can be out of sync.  When
this happens SQL Server will actually try to use an Identity value that
already exists.

Run DBCC CheckIdent against the offending table and normal operation should
be restored.  Some recommend automatically running this on all tables at
start up to avoid the problem.

Quote:

>Hi,

>I've come accrrosed an odd situation in sql server 6.5 where i have a table
>named tb_order and the primary key for that table is order_id (identity
seed
>1). When i tried to insert a record in that table the mesage get is the
>primary key violation. But it's a identity column and there wasn't any
>duplicate key data.

>I had to drop the table and create it again to get it working.

>DO have any idea why it might occur?



Sun, 25 Nov 2001 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. ODBC key violation Object SQL Server in unique index

2. Key Violation on Index Creation

3. primary key access violation?

4. key violations upsizing from access 2000

5. Key violation - MS Access DB and Delphi 3.0

6. INSERT INTO TABLE KEYED ONLY ON IDENTITY COLUMN RESULTS IN KEY VIOLATION (6.5)

7. Violation of PRIMARY KEY constraint Cannot insert duplicate key in object

8. Paradox Key Violation - changing a keyed field

9. Preventing Key Violation for duplicate keys

10. Reordering of key fields leads to key violations (Pdox 5.0)

11. Reordering of key fields leads to key violations (Pdox 5.0)


 
Powered by phpBB® Forum Software