Deleting All Rows with DELETE Statements in SQL Server

Q

How To Delete All Rows with DELETE Statements in SQL Server?

✍: FYIcenter.com

A

If you want to delete all rows from a table, you have two options:

  • Use the DELETE statement with no WHERE clause.
  • Use the TRUNCATE TABLE statement.

Here is an example of deleting all rows with a DELETE statement:

SELECT COUNT(*) FROM fyi_links
GO
4

DELETE FROM fyi_links
GO
(4 row(s) affected)

SELECT COUNT(*) FROM fyi_links
GO
0

 

Using INSERT, UPDATE and DELETE Statements in SQL Server

⇒⇒SQL Server Database Tutorials

2016-10-30, 408👍, 0💬