4.3. DELETE

The DELETE command removes rows from a table.

4.3.1. DELETE Syntax

The following code shows the basics of the DELETE syntax and the parameters of its use.

Syntax
DELETE  [ FROM ]
{
   table_name WITH ( < table_hint_limited > [ ...n ] )
   | view_name -- view must be updatable, delete may affect only one base
                   table in the view
   | rowset_function_limited
}
[ FROM { < table_source > } [ ,...n ] ]
[ WHERE
   {
     < search_condition >
   |  CURRENT OF  {  [ GLOBAL ] cursor_name |  cursor_variable_name    }
   }
]
[ OPTION ( < query_hint > [ ,...n ] ) ]


< table_source > ::=
   table_name [ [ AS ] table_alias ] [ WITH ( < table_hint > [ ,...n ] ) ]
   | view_name [ [ AS ] table_alias ]
   | rowset_function [ [ AS ] table_alias ]
   | subquery [ AS ] table_alias [ ( column_alias ...

Get Transact-SQL Desk Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.