25

I need to remove diagramming support tables, stored procs, views, etc from SQL Servrer using TSQL script.

Is there such a script available?

SQL 2005 and 2008.

Cade Roux
  • 88,164
  • 40
  • 182
  • 265
dmajkic
  • 3,448
  • 1
  • 18
  • 24

3 Answers3

40
DROP PROCEDURE dbo.sp_alterdiagram;  
DROP PROCEDURE dbo.sp_creatediagram;  
DROP PROCEDURE dbo.sp_dropdiagram; 
DROP PROCEDURE dbo.sp_helpdiagramdefinition; 
DROP PROCEDURE dbo.sp_renamediagram; 
DROP PROCEDURE dbo.sp_upgraddiagrams; 
DROP PROCEDURE dbo.sp_helpdiagrams;
DROP FUNCTION dbo.fn_diagramobjects;
DROP TABLE dbo.sysdiagrams;

That removes all of them. Would be nice if there was as remove diagrams references wizard like the add.

Jason Short
  • 5,205
  • 1
  • 28
  • 45
18

You can drop the objects, but a user will be prompted to recreate them when they click the diagrams node.

Objects:

  • sp_upgraddiagrams
  • sp_helpdiagrams
  • sp_helpdiagramdefinition
  • sp_creatediagram
  • sp_renamediagram
  • sp_alterdiagram
  • sp_dropdiagram
  • fn_diagramobjects
  • sysdiagrams
  • dt_properties (?)
gbn
  • 422,506
  • 82
  • 585
  • 676
0
DELETE FROM sysdiagrams -- remove all diagram
DELETE FROM sysdiagrams WHERE name = 'yourDiagram' -- remove with condition 
Zanyar Jalal
  • 1,407
  • 12
  • 29