SQL DROP Statement

DROP Statement

SQL DROP statement is used to completely delete the object from the database or you can drop database itself. You can use DROP statement to delete tables, indexes, views, procedures, users, databases etc.

DROP TABLE Statement

The DROP TABLE statement is used to delete or remove table from database. Once DROP table is executed then it will remove all data, table definitions, constraints, indexes and related triggers etc.

Syntax

DROP TABLE TableName

Let’s drop table tblPassStudents from database.

DROP TABLE tblPassStudents 

DROP TABLE

Once table is dropped and if you will query that table then it will show you error message as ‘Invalid object name ‘tblPassStudents”

DROP PROCEDURE Statement

The DROP PROCEDURE is used to remove one or more stored procedures from database.

Syntax

DROP PROCEDURE ProcedureName

Or you can also drop multiple procedures.

DROP PROCEDURE Procedure1Procedure2, …, ProcedureN

You can use DROP PROC also instead of writing whole word.

DROP DATABASE Statement

The DROP DATABASE statement is used to remove a database from SQL Server instance.

Syntax

DROP DATABASE DatabaseName

Reference: Manzoor Siddiqui [www.SQLServerLog.com]

CLICK HERE to watch live practical.

You may also like

You may also like...

Leave a Reply