repo_sys.ForeignKey - V

type: V ( view ), modify_date: 2021-08-17 19:59:47

RepoObject_guid: A356741B-6373-EB11-84E3-A81E8446D5B0

Description

Examples

Entity Diagram

entity-repo_sys.foreignkey

Columns

Table 1. Columns of repo_sys.ForeignKey - V
PK Column Name Data Type NULL? ID

datetime

NOT NULL

tinyint

NULL

nvarchar(60)

NULL

nvarchar(261)

NULL

uniqueidentifier

NULL

bit

NOT NULL

bit

NOT NULL

bit

NOT NULL

bit

NOT NULL

bit

NOT NULL

bit

NOT NULL

bit

NOT NULL

int

NULL

datetime

NOT NULL

sysname

NOT NULL

int

NOT NULL

int

NOT NULL

nvarchar(261)

NULL

uniqueidentifier

NULL

nvarchar(261)

NULL

int

NULL

int

NULL

int

NOT NULL

char(2)

NULL

nvarchar(60)

NULL

tinyint

NULL

nvarchar(60)

NULL

Foreign Key Diagram

entity_1_1_fk-repo_sys.foreignkey

References

Object Reference Diagram - 1 1

entity_1_1_objectref-repo_sys.foreignkey

Object Reference Diagram - Referenced - 30 0

entity_30_0_objectref-repo_sys.foreignkey

Object Reference Diagram - Referencing - 0 30

entity_0_30_objectref-repo_sys.foreignkey

Column Reference Diagram

entity_1_1_colref-repo_sys.foreignkey

Indexes

idx_ForeignKey__1

idx_ForeignKey__2

Column Details

_

create_date

create_date

datetime

NOT NULL

delete_referential_action

delete_referential_action

tinyint

NULL

delete_referential_action_desc

delete_referential_action_desc

nvarchar(60)

NULL

ForeignKey_fullname

ForeignKey_fullname

nvarchar(261)

NULL

Description

(concat('[',[RepoObject_schema_name],'].[',[RepoObject_name],']'))


ForeignKey_guid

ForeignKey_guid

uniqueidentifier

NULL

Referenced Columns

is_disabled

is_disabled

bit

NOT NULL

is_ms_shipped

is_ms_shipped

bit

NOT NULL

is_not_for_replication

is_not_for_replication

bit

NOT NULL

is_not_trusted

is_not_trusted

bit

NOT NULL

is_published

is_published

bit

NOT NULL

is_schema_published

is_schema_published

bit

NOT NULL

is_system_named

is_system_named

bit

NOT NULL

key_index_id

key_index_id

int

NULL

modify_date

modify_date

datetime

NOT NULL

name

name

sysname

NOT NULL

object_id

object_id

int

NOT NULL

parent_object_id

parent_object_id

int

NOT NULL

parent_RepoObject_fullname

parent_RepoObject_fullname

nvarchar(261)

NULL

Description

(concat('[',[RepoObject_schema_name],'].[',[RepoObject_name],']'))


parent_RepoObject_guid

parent_RepoObject_guid

uniqueidentifier

NULL

Referenced Columns

parent_SysObject_fullname

parent_SysObject_fullname

nvarchar(261)

NULL

Description

(concat('[',[SysObject_schema_name],'].[',[SysObject_name],']'))


principal_id

principal_id

int

NULL

referenced_object_id

referenced_object_id

int

NULL

schema_id

schema_id

int

NOT NULL

type

type

char(2)

NULL

type_desc

type_desc

nvarchar(60)

NULL

update_referential_action

update_referential_action

tinyint

NULL

update_referential_action_desc

update_referential_action_desc

nvarchar(60)

NULL

sql_modules_definition

repo_sys.ForeignKey - V script
CREATE View repo_sys.ForeignKey
As
Select
    fk.name
  , fk.object_id
  , fk.principal_id
  , fk.schema_id
  , fk.parent_object_id
  , fk.type
  , fk.type_desc
  , fk.create_date
  , fk.modify_date
  , fk.is_ms_shipped
  , fk.is_published
  , fk.is_schema_published
  , fk.referenced_object_id
  , fk.key_index_id
  , fk.is_disabled
  , fk.is_not_for_replication
  , fk.is_not_trusted
  , fk.delete_referential_action
  , fk.delete_referential_action_desc
  , fk.update_referential_action
  , fk.update_referential_action_desc
  , fk.is_system_named
  , ForeignKey_guid            = ro.RepoObject_guid
  , ForeignKey_fullname        = ro.RepoObject_fullname
  , parent_RepoObject_guid     = parent_ro.RepoObject_guid
  , parent_RepoObject_fullname = parent_ro.RepoObject_fullname
  , parent_SysObject_fullname  = parent_ro.SysObject_fullname
From
    sys_dwh.foreign_keys As fk
    Left Join
        repo.RepoObject  As ro
            On
            ro.SysObject_id        = fk.object_id

    Left Join
        repo.RepoObject  As parent_ro
            On
            parent_ro.SysObject_id = fk.parent_object_id