reference.RepoObjectColumn_reference_Persistence - V

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

RepoObject_guid: 0290291C-9D61-EB11-84DC-A81E8446D5B0

Description

Examples

Entity Diagram

entity-reference.repoobjectcolumn_reference_persistence

Columns

Table 1. Columns of reference.RepoObjectColumn_reference_Persistence - V
PK Column Name Data Type NULL? ID

1

int

NULL

2

int

NULL

3

int

NULL

4

int

NULL

nvarchar(max)

NULL

varchar(27)

NOT NULL

bit

NULL

bit

NULL

bit

NULL

nvarchar(128)

NOT NULL

nvarchar(128)

NOT NULL

bigint

NULL

uniqueidentifier

NULL

uniqueidentifier

NOT NULL

nvarchar(128)

NOT NULL

char(2)

NULL

nvarchar(128)

NOT NULL

nvarchar(128)

NOT NULL

bigint

NULL

uniqueidentifier

NOT NULL

uniqueidentifier

NOT NULL

nvarchar(128)

NOT NULL

char(2)

NULL

Foreign Key Diagram

entity_1_1_fk-reference.repoobjectcolumn_reference_persistence

References

Object Reference Diagram - 1 1

entity_1_1_objectref-reference.repoobjectcolumn_reference_persistence

Object Reference Diagram - Referenced - 30 0

entity_30_0_objectref-reference.repoobjectcolumn_reference_persistence

Object Reference Diagram - Referencing - 0 30

entity_0_30_objectref-reference.repoobjectcolumn_reference_persistence

Column Reference Diagram

entity_1_1_colref-reference.repoobjectcolumn_reference_persistence

Indexes

PK_RepoObjectColumn_reference_Persistence

idx_RepoObjectColumn_reference_Persistence__2

idx_RepoObjectColumn_reference_Persistence__3

idx_RepoObjectColumn_reference_Persistence__4

idx_RepoObjectColumn_reference_Persistence__5

idx_RepoObjectColumn_reference_Persistence__6

idx_RepoObjectColumn_reference_Persistence__7

idx_RepoObjectColumn_reference_Persistence__8

Column Details

_

referencing_id

1

referencing_id

int

NULL

Referenced Columns

referencing_minor_id

2

referencing_minor_id

int

NULL

referenced_id

3

referenced_id

int

NULL

Referenced Columns

referenced_minor_id

4

referenced_minor_id

int

NULL

definition

definition

nvarchar(max)

NULL

InformationSource

InformationSource

varchar(27)

NOT NULL

is_computed

is_computed

bit

NULL

is_referenced_object

is_referenced_object

bit

NULL

is_referencing_object_equal_referenced_object

is_referencing_object_equal_referenced_object

bit

NULL

referenced_column_name

referenced_column_name

nvarchar(128)

NOT NULL

referenced_entity_name

referenced_entity_name

nvarchar(128)

NOT NULL

Referenced Columns

referenced_node_id

referenced_node_id

bigint

NULL

Description

(CONVERT([bigint],[SysObject_id])*(10000))


Referenced Columns

referenced_RepoObject_guid

referenced_RepoObject_guid

uniqueidentifier

NULL

referenced_RepoObjectColumn_guid

referenced_RepoObjectColumn_guid

uniqueidentifier

NOT NULL

referenced_schema_name

referenced_schema_name

nvarchar(128)

NOT NULL

referenced_type

referenced_type

char(2)

NULL

Referenced Columns

referencing_column_name

referencing_column_name

nvarchar(128)

NOT NULL

referencing_entity_name

referencing_entity_name

nvarchar(128)

NOT NULL

Referenced Columns

referencing_node_id

referencing_node_id

bigint

NULL

Description

(CONVERT([bigint],[SysObject_id])*(10000))


Referenced Columns

referencing_RepoObject_guid

referencing_RepoObject_guid

uniqueidentifier

NOT NULL

referencing_RepoObjectColumn_guid

referencing_RepoObjectColumn_guid

uniqueidentifier

NOT NULL

referencing_schema_name

referencing_schema_name

nvarchar(128)

NOT NULL

referencing_type

referencing_type

char(2)

NULL

Referenced Columns

sql_modules_definition

reference.RepoObjectColumn_reference_Persistence - V script
CREATE View reference.RepoObjectColumn_reference_Persistence
As
--
Select
    referencing_id                                = ro_t.SysObject_id
  , referencing_minor_id                          = roc_t.SysObjectColumn_column_id
  , referencing_node_id                           = ro_t.node_id
  , referenced_id                                 = ro_s.SysObject_id
  , referenced_minor_id                           = roc_s.SysObjectColumn_column_id
  , referenced_node_id                            = ro_s.node_id
  , referencing_RepoObject_guid                   = rop.target_RepoObject_guid
  , referencing_RepoObjectColumn_guid             = roc_t.RepoObjectColumn_guid
  , referenced_RepoObject_guid                    = rop.source_RepoObject_guid
  , referenced_RepoObjectColumn_guid              = roc_s.RepoObjectColumn_guid
  --Target = referencing: Repo Names or Sys Names?
  --it is possible, that only Repo Objects exists, but they are not yet in the database
  --or they could have other names in the database
  --if they doesn't exist in the database guid are used as names
  -- => Sys Names are fine
  , referencing_type                              = ro_t.SysObject_type
  , referencing_schema_name                       = ro_t.SysObject_schema_name
  , referencing_entity_name                       = ro_t.SysObject_name
  , referencing_column_name                       = roc_t.SysObjectColumn_name
  --Source = referenced: Source should exists and we should use Sys Names
  , referenced_schema_name                        = ro_s.SysObject_schema_name
  , referenced_entity_name                        = ro_s.SysObject_name
  , referenced_column_name                        = roc_s.SysObjectColumn_name
  , referenced_type                               = ro_s.SysObject_type
  , InformationSource                             = 'repo.RepoObject_persistence'
  --persisted basic columns which are inherited are not computed
  , is_computed                                   = Cast(0 As Bit)
  , definition                                    = Cast(Null As NVarchar(Max))
  , is_referencing_object_equal_referenced_object = Cast(Case
                                                             When rop.target_RepoObject_guid = rop.source_RepoObject_guid
                                                                 Then
                                                                 1
                                                             Else
                                                                 0
                                                         End As Bit)
  , is_referenced_object                          = Cast(1 As Bit)
From
    repo.RepoObject_persistence As rop
    Inner Join
        repo.RepoObject         As ro_s
            On
            ro_s.RepoObject_guid                               = rop.source_RepoObject_guid

    Inner Join
        repo.RepoObject         As ro_t
            On
            ro_t.RepoObject_guid                               = rop.target_RepoObject_guid

    Inner Join
        repo.RepoObjectColumn   As roc_s
            On
            roc_s.RepoObject_guid                              = rop.source_RepoObject_guid

    Inner Join
        repo.RepoObjectColumn   As roc_t
            On
            roc_t.RepoObject_guid                              = rop.target_RepoObject_guid
            And roc_t.persistence_source_RepoObjectColumn_guid = roc_s.RepoObjectColumn_guid