Schema changes are uncommon in some businesses. Dropping the objects is unusual too. When deleting any database objects, one must be cautious because it may break applications, application features, or database object dependencies.
This article will show you what you can delete and how to do so.
Database
DROP DATABASE [ IF EXISTS ] dbName;
Schema
DROP SCHEMA [ IF EXISTS ] schema_name
Table
DROP TABLE [ IF EXISTS ] tblName;
Index
DROP INDEX ndx_StudentID_tblStudent ON tbStudent.
View
DROP VIEW vwStudentPayInfo
Procedure
DROP PROCEDURE uspSomeProc
Trigger
DROP TRIGGER trgPayHistory
User Defined Function
DROP FUNCTION functionName
User
DROP USER userName
Login
DROP LOGIN loginName
Role
DROP ROLE roleName
IF EXISTS is optional, but it is recommended if you want to avoid errors.
Hope you find this article helpful.
We are in the process of thoroughly explaining every aspect of SQL Server, from basic to advanced concepts, with syntax and numerous examples. Please go to the index page.
One comment