Wednesday, 23 January 2019

Drop all tables and stored procedures

In this article, I am explaining how to drop all tables and procedures in Sql Server.

Query:-


SELECT 'DROP Procedure [' + SCHEMA_NAME(p.schema_id) + '].[' + p.NAME + '];'
FROM sys.procedures p

SELECT 'DROP TABLE [' + SCHEMA_NAME(p.schema_id) + '].[' + p.NAME + '];'
FROM sys.tables p


With the help of above queries, we got  drop statement for  all procedures and tables.