Answers

Question and Answer:

  Home  MS SQL Server

⟩ How To Delete an Existing Row with DELETE Statements in MS SQL Server?

If you want to delete an existing row from a table, you can use the DELETE statement with a WHERE clause to identify that row. Here is good sample of DELETE statements:

-- insert a row for this test

INSERT INTO ggl_links (url, id)

VALUES ('www.google.com', 301)

GO

(1 row(s) affected)

-- view the inserted row

SELECT id, url, notes, counts FROM ggl_links

WHERE id = 301

GO

id url notes counts

301 www.google.com NULL NULL

-- delete one row

DELETE FROM ggl_links WHERE id = 301

GO

(1 row(s) affected)

-- try to view the deleted row

SELECT id, url, notes, counts FROM ggl_links

WHERE id = 301

no rows

Row with id of 301 is truly deleted.

 198 views

More Questions for you: