DROP SCHEMA in SQL Server Last Updated : 04 Sep, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The DROP SCHEMA statement could be used to delete a schema from a database. SQL Server have some built-in schema, for example : dbo, guest, sys, and INFORMATION_SCHEMA which cannot be deleted. Syntax : DROP SCHEMA [IF EXISTS] schema_name; Note : Delete all objects from the schema before dropping the schema. If the schema have any object in it, the output will be an error. Example : Let us create a new schema named geeksh (https://www.geeksforgeeks.org/create-schema-in-sql-server/); CREATE SCHEMA geeksh; GO Now create a table named geektab inside the geeksh schema : CREATE TABLE geeksh.geektab (id INT PRIMARY KEY, date DATE NOT NULL, city varchar(200) NOT NULL); Drop the schema geeksh : DROP SCHEMA geeksh; SQL Server will throw similar error as the schema is not empty. Msg 3729, Level 16, State 1, Line 1 Cannot drop schema 'geeksh' because it is being referenced by object 'geektab'. Let us drop the table geeksh.geektab : DROP TABLE geeksh.geektab; Again run the DROP SCHEMA again to drop the geeksh schema : DROP SCHEMA IF EXISTS geeksh; Now, the geeksh schema has been deleted from the database. Comment More infoAdvertise with us Next Article How to Rename SQL Server Schema? K khushboogoyal499 Follow Improve Article Tags : SQL SQL-Server Similar Reads ALTER SCHEMA in SQL Server The SQL Server ALTER SCHEMA statement is used to transfer an object (table, view, or function) from one schema to another schema in the same database.The ALTER SCHEMA statement is used to transfer an object from a schema to another schema in the same database. SyntaxALTER SCHEMA target_schema_name T 2 min read CREATE SCHEMA in SQL Server A schema is a collection of database objects like tables, triggers, stored procedures, etc. A schema is connected with a user which is known as the schema owner. The database may have one or more schema. To create a schema in SQL Server use the 'CREATE SCHEMA' Statement. SQL CREATE SCHEMACREATE SCHE 2 min read Drop login in SQL Server The DROP LOGIN statement could be used to delete an user or login that used to connect to a SQL Server instance. Syntax - DROP LOGIN loginname; GO Permissions : The user which is deleting the login must have ALTER ANY LOGIN permission on the server. Note - A login which is currently logged into SQL 1 min read How to Rename SQL Server Schema? In SQL, we cannot RENAME a SCHEMA. To achieve this, we need to create a new SCHEMA, transfer all the contents(objects) from the old schema to new schema and then finally delete the old schema using the DROP command. The same is depicted in the below article. For this article, we will be using the Mi 3 min read Create, Alter and Drop schema in MS SQL Server Schema management in MS SQL Server involves creating, altering, and dropping database schema elements such as tables, views, stored procedures, and indexes. It ensures that the database structure is optimized for data storage and retrieval. In this article, we will be discussing schema and how to cr 4 min read Introduction of MS SQL Server Data is a collection of facts and figures and we have humungous data available to the users via the internet and other sources. To manipulate the data, Structured Query Language (SQL) in short has been introduced years ago. There are different versions of SQL available in the market provided by diff 2 min read Like