Open
Description
This mssqlserver view can't be parsed
the issue could be related to the in-column-statement, which for example is used at
- InheritDescriptions_actual
- PK_json
CREATE VIEW [integration].[Schema_Table] AS
SELECT
[Schema_Name] = [T2].[Schema_Name],
[Table_Name] = [T1].[Table_Name],
[AnonStatement] = [T1].[AnonStatement],
[CompressionTypeID] = [T1].[CompressionTypeID],
[Description] = [T1].[Description],
[DoNotExport] = [T1].[DoNotExport],
[DontInheritPK] = [T1].[DontInheritPK],
[FriendlyName] = [T1].[FriendlyName],
[Hashkey] = [T1].[Hashkey],
[HistOfTableID] = [T1].[HistOfTableID],
[HubOfTableID] = [T1].[HubOfTableID],
[InheritDescriptions] = [T1].[InheritDescriptions],
[InheritDescriptions_actual] = ISNULL([T1].[InheritDescriptions], -- Parameter_Name must exist in INTERN.PARAMETERS:
--(SELECT ParameterValue = COALESCE(PV.Param_Value, P.Default_Value, '') FROM INTERN.PARAMETERS P (NOLOCK) LEFT JOIN [CFG].[PARAM_VALUES] PV (NOLOCK) ON PV.Param_Name = P.Param_Name WHERE P.Param_Name = 'DESCRIPTION_INHERIT_TABLES')
--this works also for Custom-Parmeters, existing only in [CFG].[PARAM_VALUES]:
(SELECT ParameterValue = COALESCE(PV.Param_Value, P.Default_Value, '') FROM (SELECT Param_Name FROM INTERN.PARAMETERS (NOLOCK) UNION SELECT Param_Name FROM INTERN.PARAMETERS (NOLOCK)) AS U LEFT JOIN INTERN.PARAMETERS P (NOLOCK) ON P.Param_Name = U.Param_Name LEFT JOIN [CFG].[PARAM_VALUES] PV (NOLOCK) ON PV.Param_Name = U.Param_Name WHERE P.Param_Name = 'DESCRIPTION_INHERIT_TABLES')
),
[InheritFriendlyNames] = [T1].[InheritFriendlyNames],
[InheritFriendlyNames_actual] = ISNULL([T1].[InheritFriendlyNames], -- Parameter_Name must exist in INTERN.PARAMETERS:
--(SELECT ParameterValue = COALESCE(PV.Param_Value, P.Default_Value, '') FROM INTERN.PARAMETERS P (NOLOCK) LEFT JOIN [CFG].[PARAM_VALUES] PV (NOLOCK) ON PV.Param_Name = P.Param_Name WHERE P.Param_Name = 'FRIENDLYNAME_INHERIT_TABLES')
--this works also for Custom-Parmeters, existing only in [CFG].[PARAM_VALUES]:
(SELECT ParameterValue = COALESCE(PV.Param_Value, P.Default_Value, '') FROM (SELECT Param_Name FROM INTERN.PARAMETERS (NOLOCK) UNION SELECT Param_Name FROM INTERN.PARAMETERS (NOLOCK)) AS U LEFT JOIN INTERN.PARAMETERS P (NOLOCK) ON P.Param_Name = U.Param_Name LEFT JOIN [CFG].[PARAM_VALUES] PV (NOLOCK) ON PV.Param_Name = U.Param_Name WHERE P.Param_Name = 'FRIENDLYNAME_INHERIT_TABLES')
),
[InheritReferences] = [T1].[InheritReferences],
[IsInMemory] = [T1].[IsInMemory],
[LinkOfTableID] = [T1].[LinkOfTableID],
[OLAP_DataCategory] = [T1].[OLAP_DataCategory],
[OLAP_IsHidden] = [T1].[OLAP_IsHidden],
[PersistOfTableID] = [T1].[PersistOfTableID],
[Perspective] = [T1].[Perspective],
[SatOfTableID] = [T1].[SatOfTableID],
[SchemaID] = [T1].[SchemaID],
[SchemaName_TableName] = CONCAT(T2.Schema_Name, '.', [T1].[Table_Name]),
[SchemaName_TableName_brackets] = CONCAT('[', T2.Schema_Name, '].[', [T1].[Table_Name], ']'),
[TableID] = [T1].[TableID],
[TableType_Name] = [T3].[Type_Name],
[TableTypeID] = [T1].[TableTypeID],
[PK_json] = --sorted list of PK:
(
SELECT
[PK_Ordinal_Position] AS PK
, [Column_Name] AS C
FROM
[CFG].[COLUMNS] AS cfgc
WHERE
[T1].[TableID] = cfgc.[TableID]
AND NOT [PK_Ordinal_Position] IS NULL
ORDER BY [PK_Ordinal_Position]
FOR JSON AUTO
)
FROM
[CFG].[TABLES] T1 (NOLOCK)
LEFT JOIN [CFG].[SCHEMAS] T2 (NOLOCK) ON
T2.[SchemaID] = T1.[SchemaID]
LEFT JOIN [INTERN].[TABLE_TYPES] T3 (NOLOCK) ON
T3.[TableTypeID] = T1.[TableTypeID]
WHERE
1 = 1