7.6.1 removed with Enterprise Manager
When you right-click the table you want to delete from the Enterprise Manager, select the Delete (delete) option from the shortcut menu, the Delete Object dialog box appears as shown in Figure 7-9, and you can delete the table by clicking the Drop All button. When you click the Show Dependencies button, a dialog box appears as shown in Figure 7-10. It lists the objects that the table relies on and the objects that are dependent on the table. You cannot delete a table when an object relies on a table.
7.6.2 Delete with Drop TABLE command
The drop table command can delete data in a table and table and all indexes, triggers, constraints, and license objects associated with the table (table-related views and stored procedures need to be removed with the drop view and drop procedure commands).
The syntax for the DROP TABLE command is as follows:
DROP TABLE table_name
The table to be deleted if it is not in the current database, specify the database and user name to which it belongs in table_name. Remove the foreign keyword constraint from the table associated with this table before deleting a table. When you delete a table, the bound rule or default value is automatically untied.
Note: system tables cannot be deleted.
Example 7-23: Deletes the table orders1 in the MyDB database.
drop table Mydb.dbo.orders1
Summary of this chapter
This chapter describes the knowledge of creating and managing database tables, and for a detailed introduction to changing the data in the table, see Chapter 11th "Database updates."
See the full set of "MS SQL Basics Tutorials"