The SQL command DELETE removes rows. The basic syntax is as follows:
DELETE [[FROM] TableSources] [WHERE RowSearchCondition]
The DELETE command removes all rows from
The FROM clause specifies other table or view sources to be utilized in the search condition of the WHERE clause of a DELETE command, i.e. no rows are deleted from
The WHERE clause makes the DELETE command remove only the rows that meet the
DELETE all rows
Delete all rows from a table but not the table itself.
DELETE tblProducts // If the target is a simple table, then FROM keyword is optional.
If you are deleting all rows and the contents of the transaction log, and want to reset the identity seed, then consider using the TRUNCATE command
TRUNCATE TABLE tblProducts
DELETE some rows
Delete some rows from a table.
DELETE FROM tblProducts WHERE ProductName = 'Thingy'
DELETE based on data from other table
Delete some rows from a table based on data from another table.
DELETE FROM tblProducts FROM tblSuppliers JOIN tblProducts ON tblProducts.SupplierID = tblSuppliers.SupplierID WHERE tblSuppliers.CompanyName = 'Doodads'
DELETE via script
Delete via a Transact-SQL script, stored procedure, or trigger.
DECLARE FROM abc CURSOR FOR SELECT * FROM tblMine OPEN abc FETCH NEXT FROM abc DELETE tblMine WHERE CURRENT OF abc CLOSE abc DEALLOCATE abc