Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edit selected rows manually in SQL Server

Tags:

I have a database in which some editing operations have to be done manually on some rows. I have the SQL Server Management Studio Express. In SSMS, to edit the rows, normally the option is:

Select DB > Table > Right Click > Edit top 200 rows

But, the problem here is that I only have to edit some selected rows. I am able to retrieve these selected rows by the following query:

/****** Script for SelectTopNRows command from SSMS  ******/ SELECT *   FROM [test].[dbo].[Sheet1] WHERE Item1 IS NULL OR Item2 IS NULL 

Now, I have to perform some edit operations (moving some data from some columns to others) which can't be performed with a query because of no single observable pattern for editting. So, the question remains, how can I get these rows in edit mode to do my task?

like image 719
Cipher Avatar asked Mar 04 '12 06:03

Cipher


People also ask

How do I edit specific rows in SQL?

Right-click the view and select Edit Top 200 Rows. You may need to modify the SELECT statement in the SQL pane to return the rows to be modified. In the Results pane, locate the row to be changed or deleted. To delete the row, right-click the row and select Delete.

How do I edit top 200 rows in SQL Server?

By right-clicking on the table name I select the command "Edit Top 200 Rows". By the way, the number of rows loaded with this command can be changed by the option "Tools > Options > SQL Server Object Explorer > Commands > Value for Edit top <n> Rows command". If 0 is entered, all rows or options are loaded.

How do I edit cells in SQL Server Management Studio?

In SSMS, you can do this by right-clicking the table and selecting “Edit top 200 rows”. You'll be taken to a grid where you can modify the value of each cell.


2 Answers

Click edit rows on the table and then open the sql tab of that query and add your predicate there. And that's how you can edit filtered records.

enter image description here

like image 63
Denis Valeev Avatar answered Sep 19 '22 01:09

Denis Valeev


As you said, go for

Select DB > Table > Right Click > Edit top 200 rows 

Now the window opens with the top 200 query and the results editable.

Now change the query to the one with your where clause and hit F5

like image 43
PraveenVenu Avatar answered Sep 21 '22 01:09

PraveenVenu