repo.RepoObject_related_FK_union - V

type: V ( view ), modify_date: 2021-10-02 13:23:34

RepoObject_guid: 1C224606-439A-EB11-84F5-A81E8446D5B0

Description

Examples

Entity Diagram

entity-repo.repoobject_related_fk_union

Columns

Table 1. Columns of repo.RepoObject_related_FK_union - V
PK Column Name Data Type NULL? ID

1

uniqueidentifier

NULL

2

uniqueidentifier

NULL

nvarchar(257)

NULL

nvarchar(128)

NULL

nvarchar(257)

NULL

nvarchar(128)

NULL

Foreign Key Diagram

entity_1_1_fk-repo.repoobject_related_fk_union

References

Object Reference Diagram - 1 1

entity_1_1_objectref-repo.repoobject_related_fk_union

Object Reference Diagram - Referenced - 30 0

entity_30_0_objectref-repo.repoobject_related_fk_union

Object Reference Diagram - Referencing - 0 30

entity_0_30_objectref-repo.repoobject_related_fk_union

Column Reference Diagram

entity_1_1_colref-repo.repoobject_related_fk_union

Indexes

PK_RepoObject_related_FK_union

Column Details

_

RepoObject_guid

1

RepoObject_guid

uniqueidentifier

NULL

included_RepoObject_guid

2

included_RepoObject_guid

uniqueidentifier

NULL

included_RepoObject_fullname2

included_RepoObject_fullname2

nvarchar(257)

NULL

included_SchemaName

included_SchemaName

nvarchar(128)

NULL

RepoObject_fullname2

RepoObject_fullname2

nvarchar(257)

NULL

SchemaName

SchemaName

nvarchar(128)

NULL

sql_modules_definition

repo.RepoObject_related_FK_union - V script
/*
<<property_start>>Description
included_RepoObject:
* all RepoObject with potential FK (u - user table, v - view) +
Relation to themself to ensure, all RO are included into docs
* relation PK <- FK
* relation FK -> PK
*/
CREATE View repo.RepoObject_related_FK_union
As
Select
    ro.RepoObject_guid
  , ro.RepoObject_fullname2
  , SchemaName                    = ro.RepoObject_schema_name
  , included_RepoObject_guid      = ro.RepoObject_guid
  , included_RepoObject_fullname2 = ro.RepoObject_fullname2
  , included_SchemaName           = ro.RepoObject_schema_name
From
    repo.RepoObject As ro
Where
    ro.RepoObject_type In
    ( 'u', 'v' )
Union
Select
    referenced_RepoObject_guid
  , referenced_RepoObject_fullname2
  , referenced_SysObject_schema_name
  , referencing_RepoObject_guid
  , referencing_RepoObject_fullname2
  , referencing_SysObject_schema_name
From
    repo.ForeignKey_Indexes_union_T
Union
Select
    referencing_RepoObject_guid
  , referencing_RepoObject_fullname2
  , referencing_SysObject_schema_name
  , referenced_RepoObject_guid
  , referenced_RepoObject_fullname2
  , referenced_SysObject_schema_name
From
    repo.ForeignKey_Indexes_union_T