repo.ForeignKey_IndexPattern - V

type: V ( view ), modify_date: 2022-09-08 16:19:51

RepoObject_guid: 7E170058-C073-EB11-84E3-A81E8446D5B0

Description

Examples

Entity Diagram

entity-repo.foreignkey_indexpattern

Columns

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

1

int

NOT NULL

2

uniqueidentifier

NULL

tinyint

NULL

nvarchar(261)

NULL

sysname

NULL

nvarchar(max)

NULL

uniqueidentifier

NULL

nvarchar(max)

NULL

uniqueidentifier

NULL

tinyint

NULL

Foreign Key Diagram

entity_1_1_fk-repo.foreignkey_indexpattern

References

Referencing Objects

Object Reference Diagram - 1 1

entity_1_1_objectref-repo.foreignkey_indexpattern

Object Reference Diagram - Referenced - 30 0

entity_30_0_objectref-repo.foreignkey_indexpattern

Object Reference Diagram - Referencing - 0 30

entity_0_30_objectref-repo.foreignkey_indexpattern

Column Reference Diagram

entity_1_1_colref-repo.foreignkey_indexpattern

Indexes

PK_ForeignKey_IndexPattern

idx_ForeignKey_IndexPattern__2

Column Details

_

constraint_object_id

1

constraint_object_id

int

NOT NULL

Referenced Columns

ForeignKey_guid

2

ForeignKey_guid

uniqueidentifier

NULL

delete_referential_action

delete_referential_action

tinyint

NULL

ForeignKey_fullname

ForeignKey_fullname

nvarchar(261)

NULL

ForeignKey_name

ForeignKey_name

sysname

NULL

referenced_IndexPatternColumnName

referenced_IndexPatternColumnName

nvarchar(max)

NULL

referenced_RepoObject_guid

referenced_RepoObject_guid

uniqueidentifier

NULL

referencing_IndexPatternColumnName

referencing_IndexPatternColumnName

nvarchar(max)

NULL

referencing_RepoObject_guid

referencing_RepoObject_guid

uniqueidentifier

NULL

update_referential_action

update_referential_action

tinyint

NULL

sql_modules_definition

repo.ForeignKey_IndexPattern - V script
CREATE View repo.ForeignKey_IndexPattern
As
Select
    --
    constraint_object_id               = fk.object_id
  , fk.ForeignKey_guid
  , ForeignKey_name                    = Max ( fkc.ForeignKey_name )
  , ForeignKey_fullname                = Max ( fk.ForeignKey_fullname )
  , referencing_RepoObject_guid        = Max ( fkc.referencing_RepoObject_guid )
  , referenced_RepoObject_guid         = Max ( fkc.referenced_RepoObject_guid )
  , referencing_IndexPatternColumnName = String_Agg ( Cast(fkc.referencing_column_name As NVarchar(Max)), ',' ) Within Group(Order By
                                                                                                                                 fkc.constraint_column_id)
  -- , referencing_IndexPatternColumnGuid = String_Agg(CAST(referencing_RepoObjectColumn_guid AS VARCHAR(36)), ',') WITHIN
  --GROUP (
  --  ORDER BY [constraint_column_id]
  --  )
  , referenced_IndexPatternColumnName  = String_Agg ( Cast(fkc.referenced_column_name As NVarchar(Max)), ',' ) Within Group(Order By
                                                                                                                                fkc.constraint_column_id)
  -- , referenced_IndexPatternColumnGuid = String_Agg(CAST(referenced_RepoObjectColumn_guid AS VARCHAR(36)), ',') WITHIN
  --GROUP (
  --  ORDER BY [constraint_column_id]
  --  )
  , delete_referential_action          = Max ( fk.delete_referential_action )
  , update_referential_action          = Max ( fk.update_referential_action )
From
    repo_sys.ForeignKey           As fk
    Left Join
        repo_sys.ForeignKeyColumn As fkc
            On
            fkc.ForeignKey_guid = fk.ForeignKey_guid
Group By
    fk.object_id
  , fk.ForeignKey_guid