The SQL command DELETE removes rows. The basic syntax is as follows:
DELETE [[FROM] TableSources] [WHERE RowSearchCondition]
The DELETE command removes all rows from TableOrView.
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 TableSources.
The WHERE clause makes the DELETE command remove only the rows that meet the RowSearchCondition.
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.
Delete some rows from a table.
DELETE FROM tblProducts WHERE ProductName = 'Thingy'
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 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
Page Modified: (Hand noted: 2007-10-12 20:09:57Z) (Auto noted: 2008-06-05 18:39:37Z)