Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7802757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:21:04+00:00 2026-06-02T01:21:04+00:00

I have an auto increment identity column in sql server, but I want to

  • 0

I have an auto increment identity column in sql server, but I want to specify a specific value for one of the rows. So the number scheme would be as follows:

1 ...,
2....,
999 - for the reserved entry,
3....,
n....

How can I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:21:05+00:00Added an answer on June 2, 2026 at 1:21 am

    You need to use IDENTITY_INSERT:

    SET IDENTITY_INSERT MyTableName ON
    
    INSERT INTO MyTableName
    (IdField, <list of all the fields>)
    VALUES
    (999, <list of other values)
    
    SET IDENTITY_INSERT MyTableName OFF
    
    DBCC CHECKIDENT(MyTableName, RESEED, 2)
    

    You also have to use the explicit field list in the INSERT statement, and are limited to one active IDENTITY_INSERT per session.

    This will also reset the seed value to be whatever you inserted if it’s higher than the current ID value.

    You can get around this too by using DBCC CHECKIDENT but it’ll be a big pain to manage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table with an auto-increment field, but I need to transfer the table
I have a table with a primary key that is auto increment. I want
To get the seed and step values of an identity column in sql server
Possible Duplicate: Adding an identity to an existing column how to set auto increment
I want to know if I can create an Identity (auto increment on a
I can either have an auto increment id field as my primary key or
I'm using Jqgrid to display a table, and I have a auto increment primary
I have a primary key set up to auto increment. I am doing multiple
I want to have two different tables in MS SQL, for example users and
I have two value in one table in database which I need to autoincrement.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.