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

Posted on 2009-02-19
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?
Question by:Robert Treadwell
    LVL 60

    Expert Comment

    you can add this to the table

    alter table tablename
    add idcolumn int identity(1,1) primary key
    LVL 60

    Expert Comment

    quick change:

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

    Author Comment

    by:Robert Treadwell
    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]
    LVL 60

    Accepted Solution

    try to make the change through the ssms interface rather than through tsql code.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    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 …
    How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    779 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

    13 Experts available now in Live!

    Get 1:1 Help Now