SQL - Structured Query Language |
DROP TABLEDROP TABLE is used to delete Structure of Table along with Indexes, Triggers, Constraints and User Authentication Information from database files. Any View and Stored Procedure that references the dropped table must be explicitly dropped by using DROP VIEW or DROP PROCEDURE. DROP TABLE cannot execute when the table is referenced by a FOREIGN KEY constraint to avoid error, the referencing FOREIGN KEY constraint or the referencing (child) table must be drop and then execute to drop (parent) table. Any VARBINARY(MAX) column with the FILESTREAM attribute that references the dropped table must be explicitly delete the file system files. Example 01 Delete Existing Table The following example is used to delete structure of Employee table along with data and indexes from current eBusiness database. -- Delete Existing Table --
USE eBusiness GO
DROP TABLE EMP Example 02 Delete External Database's Table The following example is used to delete structure of Employee table along with data and indexes from external eBusiness database. -- Delete Existing Table in other Database --
USE master GO
DROP TABLE eBusiness.dbo.EMP_TEST Example 03 Delete Existing Temporary Table The following example is used to delete structure of #EMP temporary table along with data from tempdb database. -- Delete Existing Temporary Table --
USE eBusiness GO
DROP TABLE #EMP |
* * * * *