Link to home
Start Free TrialLog in
Avatar of Robert Treadwell
Robert TreadwellFlag for United States of America

asked on

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

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?
Avatar of chapmandew
chapmandew
Flag of United States of America image

you can add this to the table


alter table tablename
add idcolumn int identity(1,1) primary key
quick change:

alter table tablename
add idcolumn int not null identity(1,1) primary key
Avatar of Robert Treadwell

ASKER

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]
ASKER CERTIFIED SOLUTION
Avatar of chapmandew
chapmandew
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial