119

In Microsoft SQL Server Management Studio 2008, is there a secret to be able to edit one row based on a key?

There's an option to do "Edit Top 200 Rows", but what if I want to select some other row and edit it in the datagrid? I would rather do that than code an update statement and risk messing up the where clause.

Arseni Mourzenko
  • 50,338
  • 35
  • 112
  • 199
NealWalters
  • 17,197
  • 42
  • 141
  • 251

4 Answers4

213

Use the "Edit top 200" option, then click on "Show SQL panel", modify your query with your WHERE clause, and execute the query. You'll be able to edit the results.

Aurélien Gasser
  • 3,043
  • 1
  • 20
  • 25
Nestor
  • 13,706
  • 11
  • 78
  • 119
  • 47
    Thanks! And just to add the keyboard shortcuts (SQL Server 2012 - not sure about previous versions) After using the "Edit top 200" option, you can press CTRL-3 to edit the query, CTRL+R to run the query. – gordon613 Mar 06 '13 at 17:57
  • 3
    For a more visual way of doing it, right next to "Show SQL Pane", there is a button for "Show Criteria Pane"; this lets you add filters based on a grid interface. – sleblanc May 05 '14 at 14:18
98

How to edit one specific row/tuple in Server Management Studio 2008/2012/2014/2016

Step 1: Right button mouse > Select "Edit Top 200 Rows"

Edit top 200 rows

Step 2: Navigate to Query Designer > Pane > SQL (Shortcut: Ctrl+3)

Navigate to Query Designer > Pane > SQL

Step 3: Modify the query

Modify the query

Step 4: Right button mouse > Select "Execute SQL" (Shortcut: Ctrl+R)

enter image description here

Community
  • 1
  • 1
ѺȐeallү
  • 2,887
  • 3
  • 22
  • 34
2

The menu location seems to have changed to:

Query Designer --> Pane --> SQL

Shawn
  • 73
  • 1
  • 4
  • Thanks for the contribution, but this is not an answer. If it is correct this should probably be edited into the existing answer, but of course with mention of from which version this applies. – Dennis Jaheruddin Jul 03 '14 at 09:01
  • Could you please expand your answer. – Matas Vaitkevicius Jul 03 '14 at 09:09
  • ѺȐeallү's newer answer also reflects this change in the menus. Note I'm using Server Management Studio 11.0.x (SQL Server 2012). As ѺȐeallү details very well with steps and screenshots, the menu location has been moved to: Query Designer --> Pane --> SQL – Shawn Jul 03 '14 at 17:34
0

If you are facing challenges in saving data from the results pane after using Edit Top 200 Rows option, then the below steps are for you:

  1. Run the query or view that has the data you want to edit.
  2. Navigate to the cells containing the data you want to change.
  3. Type in the new data.
  4. Save your changes by leaving the row.

Ref: MS Docs

Mayur Saner
  • 444
  • 5
  • 10
  • Welcome, but since there were several good answers with pictures on this post, no need for another one that doesn't provide any new or additional information. – NealWalters May 05 '21 at 17:12