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 6554497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:42:25+00:00 2026-05-25T12:42:25+00:00

Possible Duplicate: Adding an identity to an existing column how to set auto increment

  • 0

Possible Duplicate:
Adding an identity to an existing column
how to set auto increment after creating a table without any data loss?

I have a table Activities with two columns: Activity and ActivityId. ActivityId is the primary key. This table is referenced by a Users Table, which has an ActivityId column (this column is not marked as a foreign key – is this a problem?)

When this table was created, I thought it was going to be pretty static, but now I find I need to be able to add and remove rows from it fairly often, so I want to make the ActivityId column auto increment when rows are added to it. I’ve read that in sql server, I do this by making the column the Identity column, but that this only works for new tables.

How do I add an identity to an existing table, while keeping the database consistant? For instance, it’s ok if the IDs are renumbered, so long as this change propagates through to the user table.

I tried to add the identity in SQL Server Management Studio, but it wouldn’t let me save the changes due to needing to drop and recreate the table.

  • 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-05-25T12:42:26+00:00Added an answer on May 25, 2026 at 12:42 pm

    If you are on Enterprise / Developer edition see my answer here otherwise it is not possible without rebuilding the table.

    Enabling this in SSMS is just an option you can set then it will generate the whole script for you that preserves existing identity values (Tools -> Options -> Designers -> Untick “prevent saving changes that require table re-creation”)

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

Sidebar

Related Questions

Possible Duplicate: ggplot2: Adding Regression Line Equation and R2 on graph I'm graphing data
Possible Duplicate: Does adding [Serializable] to the class have any performance implications? What is
Possible Duplicate: adding media element in windows phone 7? I Want Details Explanation and
Possible Duplicate: Growable data structure in MATLAB So in my current MATLAB script, I
Possible Duplicate: Auto-Initializing C# Lists I have a list of integers that has a
Possible Duplicate: NSString stringWithFormat adding a percent a noob question here. I have a
Possible Duplicate: Fragmentation of id's (auto_increment column) in mysql I have a news portal
Possible Duplicate: Getting a value from HttpServletRequest.getRemoteUser() in Tomcat without modifying application Short version:
Possible Duplicate: Do write-only properties have practical applications? A getter without a setter makes
Possible Duplicate: Flex 4 Group showEffect/hideEffect I have an existing flex application that uses

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.