O'Reilly logo

SQL in a Nutshell by Kevin Kline

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

DROP Statements

All of the database objects created with CREATE commands may be destroyed using complementary DROP statements. The DROP command is irreversible and permanent, so it must be used with care. The syntax follows this format:

DROP object_type [owner_name.]object_name

With most vendors, the DROP command fails if the database object is in use by another user. With some vendors, the DROP command fails if the database object has other characteristics. For example, Microsoft SQL Server does not drop a table that is replicated. The table must be removed from replication before it can be dropped.

Warning

It is important to be aware that most vendors do not notify a user if the DROP command creates a dependency problem. Thus, if a table is dropped that is used by a few views and stored procedures elsewhere in the database, no warning is issued. Those other objects simply return failures when they are accessed.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required