You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sql/sqlserver/metadata/Step02-InstallMetadataProcedures.sql
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ AS BEGIN
45
45
DECLARE @SQL NVARCHAR(max) = N'
46
46
USE [?]; DECLARE @database SYSNAME = DB_NAME();
47
47
INSERT INTO #tapcatalogs
48
-
SELECT
48
+
SELECT DISTINCT
49
49
@database,
50
50
REPLACE(@database, ''SkyNode_'', ''''),
51
51
CASE WHEN [meta.summary] IS NULL THEN N'''' ELSE CAST([meta.summary] AS NVARCHAR(max)) END AS summary,
@@ -116,7 +116,7 @@ AS BEGIN
116
116
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_NAME = ''tables'' AND TABLE_SCHEMA=''TAP_SCHEMA'') -- try first using metadata in TAP_SCHEMA
''view'' [table_type], COALESCE(ts.description, N'''') description, ts.utype, NULL as [table_index]
@@ -126,7 +126,7 @@ AS BEGIN
126
126
ELSE IF EXISTS(SELECT name from sys.tables where name = ''dbobjects'') -- try using metadata in dbobjects table
127
127
BEGIN
128
128
INSERT INTO #taptables
129
-
SELECT
129
+
SELECT DISTINCT
130
130
ta.[schema_name],
131
131
REPLACE(@database, ''SkyNode_'', '''') + ''_'' + ta.table_name as table_name,
132
132
''view'' [table_type], COALESCE(do.description, N'''') description, NULL utype, NULL as [table_index]
@@ -142,7 +142,7 @@ AS BEGIN
142
142
ELSE
143
143
BEGIN
144
144
INSERT INTO #taptables
145
-
SELECT
145
+
SELECT DISTINCT
146
146
''dbo'' as ''schema_name'',
147
147
REPLACE(@database, ''SkyNode_'', '''') + ''_'' + table_name as ''table_name'',
148
148
''view'' as table_type,
@@ -217,35 +217,35 @@ AS BEGIN
217
217
IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_NAME = ''columns'' AND TABLE_SCHEMA=''TAP_SCHEMA'') -- try first using metadata in TAP_SCHEMA
COALESCE(CAST([meta.summary] AS NVARCHAR(max)), N'''') as description, COALESCE(CAST([meta.unit] AS NVARCHAR(max)), N'''') as unit, COALESCE(CAST([meta.quantity] AS NVARCHAR(max)), N'''') as ucd, N'''' as utype,
245
245
datatype, size, arraysize, precision, scale, 1 as principal, 0 as indexed, 0 as std, column_index
0 commit comments