Solved

Change integer primary key to IDENTIITY(1,1) in SQL Server 2008 R2 Express

Posted on 2014-11-05
5
118 Views
Last Modified: 2014-11-05
My customer has SQL Server 2008 R2 Express installed. One of the tables has a primary key QueueID int NOT NULL
I need to change it to QueueID int NOT NULL IDENTITY(1,1)

When I try to do that in the table designer and click Save, I get the attached error message.
I tested it on my own SQL Server 2012 (not express) and it works fine.

Is there some setting I need to change on the customer's SQL Server to allow the change? Or is it s hard-stop restriction in the Express edition?

Best Regards,
Doug
Can-t-change-tlkpQueue.PNG
Saving changes is not permitted. The changes you have made require the following tables to be droped and re-created. You have either made the changes to a table that can't be re-created or enabled the option Prevent changes that require the table to be re-created.
Can-t-change-tlkpQueue.PNG
0
Comment
Question by:dmaclean2
  • 3
5 Comments
 
LVL 46

Expert Comment

by:Vitor Montalvão
ID: 40423435
There's already records in the table?
0
 
LVL 48

Accepted Solution

by:
PortletPaul earned 500 total points
ID: 40423440
go to:: Tools... Options... Designers... Table and Database Designers

Then untick the "prevent saving changes that require table re-creation".
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 40423445
Take care using this approach, suggest you preview the script first
0
 

Author Closing Comment

by:dmaclean2
ID: 40423484
Thanks, That's exactly what I needed. And I agree with being careful:
1. 1've already tested it on my development copy of the live database
2. I'm doing the change at night when no one is on the system and making a DB backup before I do it.

(Belt ad suspenders) :-)
0
 
LVL 48

Expert Comment

by:PortletPaul
ID: 40423507
Great (and thanks!)

All the best, Paul
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

864 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now