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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

manipulating data in identity columns

Status
Not open for further replies.

ptrack

Programmer
Mar 21, 2000
1
PH
hi. we're having some problems when inserting new records into a table. <br>
<br>
this table contains an identity column which is also its primary key. frequent deletion and addition of records occurs to the said table. upon inserting a row, it <b>sometimes</b> returns this error: <br>
<b>&quot; rdo error : 23000: [microsoft][odbc sql server driver][sql server]violation of primary key constraint 'pk___22__10': attempt to insert duplicate key in object 'md'.&quot;</b><br>
<br>
knowing that we never included the primary key column in the insert stmt., and sometimes insert command is also successful, we're having a hard time analyzing what seems to be the problem. until such time we found a topic in <i>sql server books online</i> about <b>identity property</b> stating &quot;if a row was accidentally deleted, an identity value can be re-created and reconstructed&quot; and that &quot;if an <b>identity</b> column exists for a table with frequent deletions, gaps can occur between <b>identity</b> values. if this is a concern, do not use the identity property.&quot;<br>
<br>
we're alarmed with this information and we simply want to ask if there's anything you could suggest to solve our problem. re-creating the table is the last in our list of solutions since there are already thousands of data in the database.<br>
<br>
we'll be very grateful if you can share us your knowledge. thanks.<br>
<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top