How do I add a row to when a column is read only?

  • How do I add a row to when a column is read only? I think this issue I am having is because I am using an ID field (column) that is automatically generated and incremented whenever a new row is added in Microsoft SQl Server Management Studio, I cannot manually change an ID field and it appears a different (grayer) color.

    Somehow, once, after I entered all the other items in the row and hit "Enter" on my keyboard, I managed to have a row added and the ID field was automatically generated. The problem is that it did not seem to add it out of sequence. I do not know why it would be 159 and not 157

    I deleted the row and tried again. This time, it gave me an error:

    When I try to edit the field by hand, it seems i am not allowed to:

    Please advise.

    I am using SQL Server 2008 R2

    Here are the version numbers:

    Microsoft SQL Server Management Studio10.50.2500.0

    Microsoft Analysis Services Client Tools10.50.2500.0

    Microsoft Data Access Components (MDAC)6.1.7601.17514

    Microsoft MSXML3.0 4.0 5.0 6.0

    Microsoft Internet Explorer9.0.8112.16421

    Microsoft .NET Framework2.0.50727.5466

    Operating System6.1.7601

  • A couple of things are going on here. First the reason the numbers are not sequential is because an IDENTITY column is really the number of attempted inserts. You had a couple that failed. The identity value is still incremented. This is normal behavior.

    Most importantly you should NOT use the EDIT TOP... "feature" of SSMS. There are some serious issue with it. You would be far better off writing actual DML in the form of insert statements.

    There is no way for us to know why you are getting the "read-only" message. Maybe the column is calculated? Without the ddl it is hard to determine.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply