Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello
How can i edit SQL Cell from read only to writable?
Posted
Comments
Lek Plepi 16-Feb-14 2:34am    
IMG]http://i61.tinypic.com/1z1qqo2.jpg[/IMG]

1 solution

You can not.
First of all, because there is no such thing as SQL Cell.
A custom application might hinder you in editing a value for other reasons too, but from lower level point of view (like when using SQL Management Studio), there are basics you should be aware of:
A table, and even less a query result is comparable to an excel sheet.
By default all table fields are "writable", if you have the proper rights given - on table, or even field level[^]. The fields might have some constraints, thus not all values might be accepted, but that is an other topic.
There are calculated fields, which are by definition read-only.
If you have a little bit more complicated query, than the result won't be editable, because there won't be any clear reverse link anymore between the result you see and the underlying table/tables. Thus editing the value in the grid could not be persisted - this will also lead to read-only cells.
 
Share this answer
 
Comments
Lek Plepi 16-Feb-14 2:34am    
IMG]http://i61.tinypic.com/1z1qqo2.jpg[/IMG]
Zoltán Zörgő 16-Feb-14 7:01am    
So you use Management Studio. I don't see the definition of that field, but based on it's name, it is an "ID" kind of filed, that is most likely integer, identity and primary key. It is grayed out because it is identity, thus it's value is automatically generated by the server. In general, if you edit it in that grid, live it as it is: NULL. The value will be added automatically.
But sometimes you need to enter values in such fields too. If you do it manually, simply disable identity: http://i.stack.imgur.com/17BSl.png. And re-enable it after entering the value. If you want to temporary allow inserts in such columns (like when importing large amount of data), you can do that from t-sql using SET IDENTITY_INSERT statement.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900