SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[p_sys_md_dropdiagrams]
AS

	DECLARE c_diagrams INSENSITIVE CURSOR
	FOR		
			select	name 
			from	sysdiagrams 
	
	DECLARE	@diagram sysname
	
	OPEN c_diagrams
	
	FETCH NEXT FROM c_diagrams INTO @diagram
	
	WHILE @@FETCH_STATUS = 0
	BEGIN
		PRINT 'deleting ' + @diagram
		
		exec sp_dropdiagram @diagram
		
		PRINT 'deleted'
	
		FETCH NEXT FROM c_diagrams INTO @diagram
	END
	
	
	CLOSE c_diagrams
	DEALLOCATE c_diagrams 
GO
