473,503 Members | 3,171 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Start Auto_Increment at a higher number

Is there a way to start the Primary Auto_Number at a specific number? Usually it starts at 1, but I would like to have it start at 5,000
Jul 19 '05 #1
3 1496
What kind of database? If SQL, look at "DBCC CHECKIDENT" in the BOL. Or
probably better, ask in a SQL newsgroup, as I'm no SQL Server expert.

Ray at work

"Joeandtel" <an*******@discussions.microsoft.com> wrote in message
news:95**********************************@microsof t.com...
Is there a way to start the Primary Auto_Number at a specific number?

Usually it starts at 1, but I would like to have it start at 5,000
Jul 19 '05 #2
"Joeandtel" wrote:

Is there a way to start the Primary Auto_Number at a specific number?
Usually it starts at 1, but I would like to have it start at 5,000


If SQL Server this will work:

CREATE TABLE [dbo].[TableName] (
[ID] [int] IDENTITY (5000, 1) NOT NULL ,
...
)
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #3
"Joeandtel" <an*******@discussions.microsoft.com> wrote in message
news:95**********************************@microsof t.com...
Is there a way to start the Primary Auto_Number at a specific number?

Usually it starts at 1, but I would like to have it start at 5,000

Dave provided the answer if your database is MS SQL Server. If it's
Access then you can:

1. Insert a record with an explicit auto-number value:

INSERT INTO
Foo
(
ID,
Bar
)
VALUES
(
4999,
"Kilroy was here"
)

2. Delete the inserted record

The next record will start at autonumber 5000.

Note: Your question leads me to believe that you intend to attribute
some meaning to your autonumber field. I would advise against this.
Autonumber fields should be non-meaningful, ie. their only purpose is to
provide a way to uniquely identify each record. They should not be used
for things like rank, order, weighting, etc.. Those belong in fields of
there own.

HTH
-Chris Hohmann
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3070
by: Paul Lamonby | last post by:
Hi, i want to create a unique serial number to my Db entries. I thought the best way would be to add the auto_increment primary key value to a string, then insert it into a table field...
4
1950
by: Pjotr Wedersteers | last post by:
I have a table with quiz questions. Each question has a unique ID, based on an auto_increment field. Now I've discovered that with deleting rows from the table the deleted ID's are not reissued....
9
3310
by: Bart Van der Donck | last post by:
Hello, The first column of my table is AUTO_INCREMENT. I fill my table with 5 records with a blanco value in their first field. The first column of my table will then hold the values 1,2,3,4,5...
0
1749
by: Shailesh | last post by:
I made a MyISAM table on mysql 4.0.18 NT with auto_increment column started at 2147483646. The third row I insert fails as expected because the integer range is maxed out. However, if I delete...
2
492
by: hjyn | last post by:
Hi, how can I add char to auto_increment? For example, the auto_increment is for integer, I want to add a character at the front of that number. Ex: >create table abs (UserID INT(3) NOT NULL...
5
1193
by: Dave. | last post by:
i want to learn programming so i decided to learn visual basic .net. i am new to programming, but i am willing to put forth the effort to learn VB .net. my question is where should i start, should...
1
1713
by: Phil Latio | last post by:
Newbie questions here... Reading the MySQL manual regarding InnoDB databases, can someone confirm that: 1. if the server is rebooted, AUTO_INCREMENT reverts back to 1? 2. what happens if the...
2
118254
by: Brian Bendtsen | last post by:
Hi Is there at way to reset a table and set the auto increment value to 1000? /Brian Bendtsen
1
1606
by: bcm | last post by:
I am migrating a database to MySQL 5.0. Several tables should have their primary key as an auto_increment integer. The database being copied has records with the primary key beginning with zero...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7063
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7258
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7441
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
720
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.