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: Virtual_EDW/Templates/templateLinkInsertInto.Handlebars
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
-- Link Insert Into statement for {{targetDataObject.name}}
4
4
--
5
5
6
-
INSERT INTO [{{targetDataObject.name}}]
6
+
INSERT INTO [{{targetDataObject.dataObjectConnection.extensions.0.value}}].[{{targetDataObject.dataObjectConnection.extensions.1.value}}].[{{targetDataObject.name}}]
-- Link Satellite View definition for {{../generationSpecificMetadata.selectedDataObject.name}}
3
+
-- Link Satellite View definition for {{../generationSpecificMetadata.selectedDataObject.name}}.
4
4
--
5
5
6
6
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[{{../metadataConfiguration.vdwSchemaName}}].[{{../generationSpecificMetadata.selectedDataObject.name}}]') AND type in (N'V'))
@@ -12,117 +12,104 @@ SELECT
12
12
HASHBYTES('MD5', {{#eachbusinessKeys}}{{#unless@first}} +{{/unless}}{{!-- Create the Surrogate Key using the Business Key and components --}}{{#eachbusinessKeyComponentMapping}}
DATEADD(mcs,[{{../metadataConfiguration.sourceRowIdAttribute}}], {{../metadataConfiguration.loadDateTimeAttribute}}) AS {{../metadataConfiguration.loadDateTimeAttribute}},
16
-
COALESCE (
17
-
LEAD (DATEADD(mcs,[{{../metadataConfiguration.sourceRowIdAttribute}}], {{../metadataConfiguration.loadDateTimeAttribute}}) ) OVER
18
-
( PARTITION BY {{#eachbusinessKeys}}{{!-- The Hub business key --}}{{#unless@first}},{{/unless}}
) AS [{{../metadataConfiguration.recordChecksumAttribute}}],
44
44
{{#eachdataItemMappings}}
45
-
{{sourceDataItems.0.name}} AS {{targetDataItem.name}},
45
+
[{{targetDataItem.name}}],
46
46
{{/each}}
47
47
ROW_NUMBER() OVER (PARTITION BY {{#eachbusinessKeys}}{{#unless@first}},{{/unless}}{{#eachbusinessKeyComponentMapping}}{{!-- Create a row number to enable selection only the earliest row, ordered by date/time --}}
ORDER BY {{#eachbusinessKeys}}{{#eachbusinessKeyComponentMapping}}{{!-- Create a row number to enable selection only the earliest row, ordered by date/time --}}
WHEN LAG(COMBINED_VALUE,1,0x00000000000000000000000000000000) OVER (PARTITION BY {{#eachbusinessKeys}}{{#unless@first}},{{/unless}}{{#eachbusinessKeyComponentMapping}}
ORDER BY [{{../metadataConfiguration.loadDateTimeAttribute}}] ASC, [{{../metadataConfiguration.eventDateTimeAttribute}}] ASC, [{{../metadataConfiguration.changeDataCaptureAttribute}}] DESC) = COMBINED_VALUE
73
73
THEN 'Same'
74
74
ELSE 'Different'
75
-
END AS VALUE_CHANGE_INDICATOR,
75
+
END AS [VALUE_CHANGE_INDICATOR],
76
76
CASE
77
77
WHEN LAG([{{../metadataConfiguration.changeDataCaptureAttribute}}],1,'') OVER (PARTITION BY {{#eachbusinessKeys}}{{#unless@first}},{{/unless}}{{#eachbusinessKeyComponentMapping}}
ORDER BY [{{../metadataConfiguration.loadDateTimeAttribute}}] ASC, [{{../metadataConfiguration.eventDateTimeAttribute}}] ASC, [{{../metadataConfiguration.changeDataCaptureAttribute}}] ASC) = [{{../metadataConfiguration.changeDataCaptureAttribute}}]
81
81
THEN 'Same'
82
82
ELSE 'Different'
83
-
END AS CDC_CHANGE_INDICATOR,
83
+
END AS [CDC_CHANGE_INDICATOR],
84
84
CASE
85
85
WHEN LEAD([{{../metadataConfiguration.loadDateTimeAttribute}}],1,'9999-12-31') OVER (PARTITION BY {{#eachbusinessKeys}}{{#unless@first}},{{/unless}}{{#eachbusinessKeyComponentMapping}}
ORDER BY [{{../metadataConfiguration.loadDateTimeAttribute}}] ASC, [{{../metadataConfiguration.eventDateTimeAttribute}}] ASC, [{{../metadataConfiguration.changeDataCaptureAttribute}}] ASC) = [{{../metadataConfiguration.loadDateTimeAttribute}}]
'1900-01-01' AS [{{../metadataConfiguration.loadDateTimeAttribute}}],
112
-
'1900-01-01' AS [{{../metadataConfiguration.eventDateTimeAttribute}}],
113
-
'Data Warehouse' AS [{{../metadataConfiguration.recordSourceAttribute}}],
114
-
0 AS [{{../metadataConfiguration.sourceRowIdAttribute}}],
115
-
'N/A' AS [{{../metadataConfiguration.changeDataCaptureAttribute}}],{{#eachbusinessKeys}}{{#eachbusinessKeyComponentMapping}}
116
-
CAST ({{sourceDataItems.0.name}} AS NVARCHAR(100)) AS [{{targetDataItem.name}}],{{/each}}{{/each}}
117
-
{{#eachdataItemMappings}}
118
-
{{stringcomparetargetDataItem.dataItemClassification.0.classification'MultiActive'}}[{{sourceDataItems.0.name}}]{{else}}NULL{{/stringcompare}} AS [{{sourceDataItems.0.name}}],
119
-
{{/each}}
120
-
0x00000000000000000000000000000000 AS COMBINED_VALUE
121
-
FROM [{{sourceDataObjects.0.dataObjectConnection.extensions.1.value}}].[{{sourceDataObjects.0.name}}]
122
109
) sub
123
110
) combined_value
124
111
WHERE
125
-
(VALUE_CHANGE_INDICATOR ='Different' and [{{../metadataConfiguration.changeDataCaptureAttribute}}] in ('Insert', 'Change'))
112
+
([VALUE_CHANGE_INDICATOR] = 'Different' AND [{{../metadataConfiguration.changeDataCaptureAttribute}}] IN ('C'))
126
113
OR
127
-
(CDC_CHANGE_INDICATOR = 'Different' and TIME_CHANGE_INDICATOR = 'Different')
114
+
([CDC_CHANGE_INDICATOR] = 'Different' AND [TIME_CHANGE_INDICATOR] = 'Different')
0 commit comments