Home » Posts tagged "sql script to delete database objects"

Tag Archives: sql script to delete database objects

Delete All Objects of a Database Using SQL Script

Below is the script which can be used to delete all the database objects – views, functions, procedures, constraints & tables using a this script. /* Drop all non-system stored procs */ DECLARE @name VARCHAR(128) DECLARE @SQL VARCHAR(254) SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = ‘P’ AND category = 0 ORDER BY [name]) WHILE @name is not null BEGIN SELECT @SQL = ‘DROP PROCEDURE [dbo].[' + RTRIM(@name) +']‘ EXEC (@SQL) PRINT ‘Dropped Procedure: ‘ + [...]

Tags: ,