sqlparse.RepoObject_SqlModules_Identitfier - V

type: V ( view ), modify_date: 2021-08-17 20:17:20

RepoObject_guid: 0F813EBD-7764-EB11-84DD-A81E8446D5B0

Description

Examples

Entity Diagram

entity-sqlparse.repoobject_sqlmodules_identitfier

Columns

Table 1. Columns of sqlparse.RepoObject_SqlModules_Identitfier - V
PK Column Name Data Type NULL? ID

nvarchar(max)

NULL

nvarchar(500)

NULL

bit

NULL

bit

NULL

bit

NULL

nvarchar(4000)

NOT NULL

nvarchar(max)

NULL

uniqueidentifier

NOT NULL

bigint

NULL

nvarchar(max)

NULL

nvarchar(max)

NULL

nvarchar(261)

NULL

Foreign Key Diagram

entity_1_1_fk-sqlparse.repoobject_sqlmodules_identitfier

References

Object Reference Diagram - 1 1

entity_1_1_objectref-sqlparse.repoobject_sqlmodules_identitfier

Object Reference Diagram - Referenced - 30 0

entity_30_0_objectref-sqlparse.repoobject_sqlmodules_identitfier

Object Reference Diagram - Referencing - 0 30

entity_0_30_objectref-sqlparse.repoobject_sqlmodules_identitfier

Column Reference Diagram

entity_1_1_colref-sqlparse.repoobject_sqlmodules_identitfier

Indexes

idx_RepoObject_SqlModules_Identitfier__1

idx_RepoObject_SqlModules_Identitfier__2

Column Details

_

children

children

nvarchar(max)

NULL

class

class

nvarchar(500)

NULL

is_group

is_group

bit

NULL

is_keyword

is_keyword

bit

NULL

is_whitespace

is_whitespace

bit

NULL

json_key

json_key

nvarchar(4000)

NOT NULL

normalized

normalized

nvarchar(max)

NULL

RepoObject_guid

RepoObject_guid

uniqueidentifier

NOT NULL

RowNumber_per_Object

RowNumber_per_Object

bigint

NULL

source_column

source_column

nvarchar(max)

NULL

source_table

source_table

nvarchar(max)

NULL

SysObject_fullname

SysObject_fullname

nvarchar(261)

NULL

Description

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


sql_modules_definition

sqlparse.RepoObject_SqlModules_Identitfier - V script
/*
obsolet?

--only SELECT Identifier (before FROM)
SELECT
T1.*
FROM repo.RepoObject_SqlModules_Identitfier T1
   INNER JOIN
   repo.RepoObject_SqlModules_39_object AS T39
   ON T39.RepoObject_guid = T1.RepoObject_guid
      AND T39.Min_RowNumber_From = T1.RowNumber_per_Object + 1


*/

CREATE View sqlparse.RepoObject_SqlModules_Identitfier
As
Select
    --
    T1.RepoObject_guid
  , T1.json_key
  , T1.SysObject_fullname
  , T1.RowNumber_per_Object
  , T1.class
  , T1.normalized
  , T1.is_group
  , T1.is_keyword
  , T1.is_whitespace
  --same logic: [repo].[RepoObject_SqlModules_25_IdentifierList_children_IdentifierSplit]
  --in case of an simple identifier like [T1].[aaa] get the table part (before dot) and the column part (after dot)
  , source_table  = Case
                        When T1.child1_normalized = '.'
                             And Not T1.child2_normalized Is Null
                            Then
                            T1.child0_normalized
                        When T1.child1_normalized Is Null
                            Then
                            Null
                    End
  , source_column = Case
                        When T1.child1_normalized = '.'
                             And Not T1.child2_normalized Is Null
                            Then
                            T1.child2_normalized
                        When T1.child1_normalized Is Null
                            Then
                            T1.child0_normalized
                    End
  , T1.children
--what happens in case of aa.bb as c or c = aa.bb?
--, [T1].[RepoObject_guid]
--, [T1].[json_key]
--, [T1].[SysObject_fullname]
--, [T1].[RowNumber_per_Object]
--, [T1].[class]
--, [T1].[is_group]
--, [T1].[is_keyword]
--, [T1].[is_whitespace]
--, [T1].[normalized]
--, [T1].[children]
--, [T1].[child0_class]
--, [T1].[child0_is_group]
--, [T1].[child0_is_keyword]
--, [T1].[child0_is_whitespace]
--, [T1].[child0_normalized]
--, [T1].[child0_children]
--, [T1].[child1_class]
--, [T1].[child1_is_group]
--, [T1].[child1_is_keyword]
--, [T1].[child1_is_whitespace]
--, [T1].[child1_normalized]
--, [T1].[child1_children]
--, [T1].[child2_class]
--, [T1].[child2_is_group]
--, [T1].[child2_is_keyword]
--, [T1].[child2_is_whitespace]
--, [T1].[child2_normalized]
--, [T1].[child2_children]
--, [T1].[child3_class]
--, [T1].[child3_is_group]
--, [T1].[child3_is_keyword]
--, [T1].[child3_is_whitespace]
--, [T1].[child3_normalized]
--, [T1].[child3_children]
--, [T1].[child4_class]
--, [T1].[child4_is_group]
--, [T1].[child4_is_keyword]
--, [T1].[child4_is_whitespace]
--, [T1].[child4_normalized]
--, [T1].[child4_children]
From
    sqlparse.RepoObject_SqlModules_20_statement_children As T1
Where
    T1.class = 'Identifier'