Chapter 11. Deleting Data from Microsoft SQL Server 2005

After completing this chapter, you will be able to:

  • Delete information from your database

  • Manage deletions and control row deletions

  • Delete data using ADO.NET

Using the DELETE Statement

There will be occasions when you need to delete some or all of the information in your database. You may need to remove a record inserted by error, or you may decide to delete information physically from a table when the user wants to delete some records. Alternatively, you may need to remove old information from an historical table. In all of these cases, you will use the DELETE statement.

The basic DELETE sentence is:

DELETE FROM [<ServerName>.][<DataBseName>.]<SchemaName>.<TableName>
      WHERE <Conditions>

If you ...

Get Microsoft® SQL Server™ 2005: Database Essentials Step by Step 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.