By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,333 Members | 1,843 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,333 IT Pros & Developers. It's quick & easy.

FAQ & Solution: How to generate a number automatically for thePrimary Key when inserting a record?

P: n/a
When inserting a record into a table, I want SQL Server to generate a
number automatically for the Primary Key. (e.g. OrderID is 1, 2, 3
and so on) How to do it?
(This behavior is similar to the "Auto-number" in Microsoft Access)

http://raymondlamsk.blogspot.com/200...nerate_24.html
Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Apr 22, 5:51 am, "DanielLa...@gmail.com" <DanielLa...@gmail.com>
wrote:
When inserting a record into a table, I want SQL Server to generate a
number automatically for the Primary Key. (e.g. OrderID is 1, 2, 3
and so on) How to do it?
(This behavior is similar to the "Auto-number" in Microsoft Access)

http://raymondlamsk.blogspot.com/200...ver-how-to-gen...
Hi Daniel.

I'll try to answer your question and hope it will work out.

All you have to do is to look under properties of your Primary Key
column. Below, just before the end of properties is property Identity.
You should change that property to be Yes instead of No, and click OK
to conform this change.

Sincerely yours,

Ivan Delic, Serbia
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.