473,325 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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

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
1 1946
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Tony Clarke | last post by:
Hi, I'm trying to write a system thats used for about 50 clients that uses html forms and php to log details. The problem is that when a client loads the form page it's given a value which is...
9
by: Ray | last post by:
I need to convert the normal calendar to show the week no., the period no. and the financial year. The financial year format is as follows:- Date start: 2 May, 2005 7 days a week, 4 weeks a...
1
by: Smriti Dev | last post by:
Hi, I have a question regarding autonumbering . I'm using linked tables between msql and MS Access. Quite a few linked tables exist with relationships. The auto increment fields once linked...
2
by: jmpinto | last post by:
I have a field on a form that I would like to automatically generate a number, in sequential order, each time a new record is created, and be stored in a field. The problem is that I do not want...
2
by: egoldthwait | last post by:
I need to convert a 17mb access 2000 db to Oracle and house it in a Citrix farm. The issue: we have never converted an Access Db to Oracle but can probably use Oracle's Workbench to assist with...
2
by: Mike | last post by:
Greetings, It would seem that this topic has been discussed at some length, but I was unable to discern whether there was a clear cut solution to resolve and/or otherwise workaround the issue. ...
11
by: Alan Mailer | last post by:
A project I'm working on is going to use VB6 as a front end. The back end is going to be pre-existing MS Access 2002 database tables which already have records in them *but do not have any...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
3
by: CourtGuy | last post by:
Hi Folks, I've got a problem that's been confounding me for months. I work for a criminal court, and I'm trying to set up an Access database to track petitions filed by criminal defendants. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.