Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL Server
Expertise: Beginner
Jul 15, 1999

Auto assigning primary key values

Question:
Is there a way to have SQL Server assign values to key fields automatically, so that every time a new record is added it just increases the prior record's key by one?

Answer:
Yes, you can either use the Identity function (you need to create a column in your table that uses Identity as its datatype) or you can create your own surrogate key generator.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date