The SQL Server DROP TABLE proclamation is utilized to eliminate a table definition and all information, files, triggers, limitations, and consent details for that table.
Note − You must be cautious while utilizing this order on the grounds that once a table is erased then all the data accessible in the table would likewise be lost until the end of time.
Syntax
Following is the fundamental grammar of DROP TABLE explanation −
DROP TABLE table_name;
Example
Allow us first to confirm CUSTOMERS table and afterward we will erase it from the information base −
Exec sp_columns CUSTOMERS;
The above order shows the accompanying table.
TABLE_QUALIFIER TABLE_OWNER TABLE_NAME COLUMN_NAME DATA_TYPE TYPE_NAME
PRECISION LENGTH SCALE RADIX NULLABLE REMARKS COLUMN_DEF SQL_DATA_TYPE
SQL_DATETIME_SUB CHAR_OCTET_LENGTH ORDINAL_POSITION IS_NULLABLE SS_DATA_TYPE
TestDB dbo CUSTOMERS ID 4 int 10 4 0 10 0
NULL NULL 4 NULL NULL 1 NO 56
TestDB dbo CUSTOMERS NAME 12 varchar 20 20 NULL NULL 0
NULL NULL 12 NULL 20 2 NO 39
TestDB dbo CUSTOMERS AGE 4 int 10 4 0 10 0
NULL NULL 4 NULL NULL 3 NO 56
TestDB dbo CUSTOMERS ADDRESS 1 char 25 25 NULL NULL 1
NULL NULL 1 NULL 25 4 YES 39
TestDB dbo CUSTOMERS SALARY 3 decimal 18 20 2 10 1
NULL NULL 3 NULL NULL 5 YES 106
Clients table is accessible in the data set, so let us drop it. Following is the order for the equivalent.
DROP TABLE CUSTOMERS;
Command(s) completed successfully.
With the above order, you won't get any columns.
Exec sp_columns CUSTOMERS;
No rows\data will be displayed