summaryrefslogtreecommitdiff
path: root/sql/functions.sql.template
diff options
context:
space:
mode:
Diffstat (limited to 'sql/functions.sql.template')
-rw-r--r--sql/functions.sql.template58
1 files changed, 58 insertions, 0 deletions
diff --git a/sql/functions.sql.template b/sql/functions.sql.template
new file mode 100644
index 0000000..5ac7868
--- /dev/null
+++ b/sql/functions.sql.template
@@ -0,0 +1,58 @@
+USE [@initial.catalog@]
+SET QUOTED_IDENTIFIER ON
+GO
+SET ANSI_NULLS ON
+GO
+
+
+ CREATE FUNCTION dbo.fn_diagramobjects()
+ RETURNS int
+ WITH EXECUTE AS N'dbo'
+ AS
+ BEGIN
+ declare @id_upgraddiagrams int
+ declare @id_sysdiagrams int
+ declare @id_helpdiagrams int
+ declare @id_helpdiagramdefinition int
+ declare @id_creatediagram int
+ declare @id_renamediagram int
+ declare @id_alterdiagram int
+ declare @id_dropdiagram int
+ declare @InstalledObjects int
+
+ select @InstalledObjects = 0
+
+ select @id_upgraddiagrams = object_id(N'dbo.sp_upgraddiagrams'),
+ @id_sysdiagrams = object_id(N'dbo.sysdiagrams'),
+ @id_helpdiagrams = object_id(N'dbo.sp_helpdiagrams'),
+ @id_helpdiagramdefinition = object_id(N'dbo.sp_helpdiagramdefinition'),
+ @id_creatediagram = object_id(N'dbo.sp_creatediagram'),
+ @id_renamediagram = object_id(N'dbo.sp_renamediagram'),
+ @id_alterdiagram = object_id(N'dbo.sp_alterdiagram'),
+ @id_dropdiagram = object_id(N'dbo.sp_dropdiagram')
+
+ if @id_upgraddiagrams is not null
+ select @InstalledObjects = @InstalledObjects + 1
+ if @id_sysdiagrams is not null
+ select @InstalledObjects = @InstalledObjects + 2
+ if @id_helpdiagrams is not null
+ select @InstalledObjects = @InstalledObjects + 4
+ if @id_helpdiagramdefinition is not null
+ select @InstalledObjects = @InstalledObjects + 8
+ if @id_creatediagram is not null
+ select @InstalledObjects = @InstalledObjects + 16
+ if @id_renamediagram is not null
+ select @InstalledObjects = @InstalledObjects + 32
+ if @id_alterdiagram is not null
+ select @InstalledObjects = @InstalledObjects + 64
+ if @id_dropdiagram is not null
+ select @InstalledObjects = @InstalledObjects + 128
+
+ return @InstalledObjects
+ END
+
+GO
+SET QUOTED_IDENTIFIER OFF
+GO
+SET ANSI_NULLS ON
+GO