?
Solved

start records at a new number

Posted on 2014-01-29
4
Medium Priority
?
269 Views
Last Modified: 2014-01-29
I have a table that contains data. I started the identity seed at 4000. Is there a way to have brand new records start at 5000?
0
Comment
Question by:NickMalloy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 15

Accepted Solution

by:
tim_cs earned 1200 total points
ID: 39819178
DBCC CHECKIDENT (TableName, RESEED, 4999)
0
 
LVL 16

Expert Comment

by:Surendra Nath
ID: 39819186
solution

you can change your identity seed to 5000 as shown below

DBCC CHECKIDENT ('<yourtable.YourColumn>', RESEED, 5000);
0
 
LVL 31

Expert Comment

by:James Murrell
ID: 39819187
i use reseed

something like DBCC CHECKIDENT (TableName, RESEED, 4999)
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 39819202
The high-tech answer would be DBCC CHECKIDENT
CREATE TABLE #tmp (id int identity(1,1), label varchar(50))

INSERT INTO #tmp (label) VALUES ('one'), ('two'), ('three')

DBCC CHECKIDENT (#tmp, RESEED, 999)

INSERT INTO #tmp (label) Values ('one thousand')

SELECT * FROM #tmp

Open in new window

The low-tech answer would be to just insert and delete however many rows get you to 4,999.
0

Featured Post

10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question