Skip to Content
SQL Server 2014 Development Essentials
book

SQL Server 2014 Development Essentials

by Basit A. Masood-Al-Farooq
July 2014
Intermediate to advanced
214 pages
4h 47m
English
Packt Publishing
Content preview from SQL Server 2014 Development Essentials

Deleting data from SQL Server database tables

You use the DELETE statement to delete unwanted data from SQL Server database tables.

To execute the DELETE statement, the user must at least have the DELETE permission assigned on the target table.

The basic syntax for a DELETE statement is as follows:

[WITH <common_table_expression> [,...n]]
DELETE
[TOP (expression) [percent]]
[FROM] table_name | view_name | rowset_function
[WITH table_hint]
<outputclause>
[FROM table_source]
WHERE search_conditions

The following are the arguments of a DELETE statement:

  • WITH: This keyword specifies the CTE that you can reference in your DELETE statement
  • TOP: Specify this keyword to only delete a specific number or percent of rows from the top of the query
  • table_name | view_name ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

What's New in SQL Server 2012

What's New in SQL Server 2012

Rachel Horder
Mastering SQL Server® 2008

Mastering SQL Server® 2008

Michael Lee, Gentry Bieker
Microsoft® SQL Server 2012 Unleashed

Microsoft® SQL Server 2012 Unleashed

Ray Rankins, Paul T. Bertucci, Chris Gallelli, Alex T. Silverstein

Publisher Resources

ISBN: 9781782172550Supplemental Content