We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Can't perform Create, Update or Delete operations on 'Table(Table Name)' because it has no primary key.

Medium Priority
2,569 Views
Last Modified: 2012-05-06
When I try to perform any of the above functions (Create, Update, and Delete) I receive the above error message.  My Table does have a primary key called RowID datatype int.  I am using LINQ to connect to my SQL database.

What else needs to be modified?
Comment
Watch Question

CERTIFIED EXPERT
Awarded 2008
Awarded 2008

Commented:
you can add this to the table


alter table tablename
add idcolumn int identity(1,1) primary key
CERTIFIED EXPERT
Awarded 2008
Awarded 2008

Commented:
quick change:

alter table tablename
add idcolumn int not null identity(1,1) primary key
Robert TreadwellManaging Director

Author

Commented:
Thank you for your help.

I already have a Row ID column so I will need to alter it.  Is this the right syntax for SQL Server 2008?  The reason I ask is that when I execute it doesn't make the modifications requested.

ALTER TABLE [Annoucements Current Events]
ALTER COLUMN RowID int not null IDENTITY(1,1) primary key;
Select Top 1000 * from [Annoucements Current Events]
CERTIFIED EXPERT
Awarded 2008
Awarded 2008
Commented:
try to make the change through the ssms interface rather than through tsql code.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.