property.RepoObjectColumnProperty_InheritanceType_resulting_InheritanceDefinition - V

type: V ( view ), modify_date: 2022-01-05 18:06:34

RepoObject_guid: 53B33A4A-426D-EB11-84E2-A81E8446D5B0

Description

Examples

Entity Diagram

entity-property.repoobjectcolumnproperty_inheritancetype_resulting_inheritancedefinition

Columns

Table 1. Columns of property.RepoObjectColumnProperty_InheritanceType_resulting_InheritanceDefinition - V
PK Column Name Data Type NULL? ID

nvarchar(max)

NULL

nvarchar(max)

NULL

int

NULL

int

NOT NULL

int

NOT NULL

nvarchar(128)

NOT NULL

nvarchar(max)

NULL

uniqueidentifier

NOT NULL

nvarchar(128)

NOT NULL

nvarchar(max)

NULL

Foreign Key Diagram

entity_1_1_fk-property.repoobjectcolumnproperty_inheritancetype_resulting_inheritancedefinition

References

Object Reference Diagram - 1 1

entity_1_1_objectref-property.repoobjectcolumnproperty_inheritancetype_resulting_inheritancedefinition

Object Reference Diagram - Referenced - 30 0

entity_30_0_objectref-property.repoobjectcolumnproperty_inheritancetype_resulting_inheritancedefinition

Object Reference Diagram - Referencing - 0 30

entity_0_30_objectref-property.repoobjectcolumnproperty_inheritancetype_resulting_inheritancedefinition

Column Reference Diagram

entity_1_1_colref-property.repoobjectcolumnproperty_inheritancetype_resulting_inheritancedefinition

Indexes

idx_RepoObjectColumnProperty_InheritanceType_resulting_InheritanceDefinition__1

idx_RepoObjectColumnProperty_InheritanceType_resulting_InheritanceDefinition__2

idx_RepoObjectColumnProperty_InheritanceType_resulting_InheritanceDefinition__3

idx_RepoObjectColumnProperty_InheritanceType_resulting_InheritanceDefinition__4

Column Details

_

Inheritance_StringAggSeparatorSql

Inheritance_StringAggSeparatorSql

nvarchar(max)

NULL

InheritanceDefinition

InheritanceDefinition

nvarchar(max)

NULL

InheritanceType

InheritanceType

int

NULL

is_force_inherit_empty_source

is_force_inherit_empty_source

int

NOT NULL

is_StringAggAllSources

is_StringAggAllSources

int

NOT NULL

property_name

property_name

nvarchar(128)

NOT NULL

property_value

property_value

nvarchar(max)

NULL

RepoObjectColumn_guid

RepoObjectColumn_guid

uniqueidentifier

NOT NULL

RepoObjectColumn_name

RepoObjectColumn_name

nvarchar(128)

NOT NULL

resulting_InheritanceDefinition

resulting_InheritanceDefinition

nvarchar(max)

NULL

sql_modules_definition

property.RepoObjectColumnProperty_InheritanceType_resulting_InheritanceDefinition - V script
/*
--The result must be grouped to determine all required calculation variants of an inheritance

SELECT is_StringAggAllSources
 , resulting_InheritanceDefinition
FROM repo.RepoObjectColumn_InheritanceType_resulting_InheritanceDefinition
GROUP BY is_StringAggAllSources
 , resulting_InheritanceDefinition
HAVING (NOT (resulting_InheritanceDefinition IS NULL))

*/

CREATE View property.RepoObjectColumnProperty_InheritanceType_resulting_InheritanceDefinition
As
Select
    --
    inh.RepoObjectColumn_guid
  , inh.property_name
  , inh.property_value
  , inh.InheritanceType
  , is_force_inherit_empty_source   =
  --
  Case
      When inh.InheritanceType = 14
          Then
          1
      Else
          0
  End
  , is_StringAggAllSources          =
  --
  Case
      When Not inh.Inheritance_StringAggSeparatorSql Is Null
          Then
          1
      Else
          0
  End
  , inh.Inheritance_StringAggSeparatorSql
  , resulting_InheritanceDefinition =
  --
  Case
      When (
               inh.InheritanceType = 11
               And inh.property_value Is Null
           )
           Or
           (
               inh.InheritanceType = 12
               And NullIf(inh.property_value, '') Is Null
           )
           Or inh.InheritanceType = 13
           Or inh.InheritanceType = 14
          Then
          IsNull (
                     inh.InheritanceDefinition
                   , '[property].[fs_get_RepoObjectColumnProperty_nvarchar]([referenced].[RepoObjectColumn_guid], [referencing].[property_name])'
                 )
  End
  --normally the result from [resulting_InheritanceDefinition] should not be empty to be inherited
  --this will avoid existing property_value to be deleted
  --but inheritance can be forced (dangerous!)
  , inh.InheritanceDefinition
  , inh.RepoObjectColumn_name
From
    property.RepoObjectColumnProperty_InheritanceType_InheritanceDefinition As inh