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

SQL Server - PRIMARY KEYS (autoincrement)...

Status
Not open for further replies.

MarkatTekTips2004

Programmer
Jan 12, 2005
15
US
In SQL Server 2000, I'm looking for input as to how to set up primary keys (PKs).

Is it safe to use the IDENTITY feature using AUTOINCREMENT as a setting for a PK, or is it best to generate my own and check for dups?

My concern is whether SQL Server at any point will taint the numbers used as the PK -- because as you know, these PKs are going to wind up linking into (relating into) other tables (e.g. client orders).

Certainly it's vital that the clientID not get lost/changed during any regular DB maintenance or use.

Any input would be appreciated.
 
The use of an identity column as the PK is best practice. I doubt that any attempt to make the system more reliable is a futile exercise.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top