text: ﻿
  /*extract class Statement, it should be the one and only node on first level*/
  CREATE View sqlparse.RepoObject_SqlModules_10_statement
  As
  --
  Select
      T1.RepoObject_guid
    , ro.SysObject_fullname
    , T1.sql_modules_json
    , j2.*
  From
      sqlparse.RepoObject_SqlModules As T1
      Cross Apply
      OpenJson ( T1.sql_modules_json )
      With
      (
          class NVarchar ( 500 ) N'$.class'
        , is_group Bit N'$.is_group'
        , is_keyword Bit N'$.is_keyword'
        , is_whitespace Bit N'$.is_whitespace'
        , normalized NVarchar ( Max ) N'$.normalized'
        , children NVarchar ( Max ) N'$.children' As Json
      )                              As j2
      Left Join
          repo.RepoObject As ro
              On
              ro.RepoObject_guid = T1.RepoObject_guid
  Where
      T1.is_json_sql_modules_json = 1
      And j2.class                = 'Statement'
  Go
  
  Execute sp_addextendedproperty
      @name = N'RepoObject_guid'
    , @value = 'f58f291c-9d61-eb11-84dc-a81e8446d5b0'
    , @level0type = N'SCHEMA'
    , @level0name = N'sqlparse'
    , @level1type = N'VIEW'
    , @level1name = N'RepoObject_SqlModules_10_statement';
  Go
  
  Execute sp_addextendedproperty
      @name = N'RepoObjectColumn_guid'
    , @value = 'daf17926-9d61-eb11-84dc-a81e8446d5b0'
    , @level0type = N'SCHEMA'
    , @level0name = N'sqlparse'
    , @level1type = N'VIEW'
    , @level1name = N'RepoObject_SqlModules_10_statement'
    , @level2type = N'COLUMN'
    , @level2name = N'SysObject_fullname';
  Go
  
  Execute sp_addextendedproperty
      @name = N'RepoObjectColumn_guid'
    , @value = 'dbf17926-9d61-eb11-84dc-a81e8446d5b0'
    , @level0type = N'SCHEMA'
    , @level0name = N'sqlparse'
    , @level1type = N'VIEW'
    , @level1name = N'RepoObject_SqlModules_10_statement'
    , @level2type = N'COLUMN'
    , @level2name = N'sql_modules_json';
  Go
  
  Execute sp_addextendedproperty
      @name = N'RepoObjectColumn_guid'
    , @value = 'd9f17926-9d61-eb11-84dc-a81e8446d5b0'
    , @level0type = N'SCHEMA'
    , @level0name = N'sqlparse'
    , @level1type = N'VIEW'
    , @level1name = N'RepoObject_SqlModules_10_statement'
    , @level2type = N'COLUMN'
    , @level2name = N'RepoObject_guid';
  Go
  
  Execute sp_addextendedproperty
      @name = N'RepoObjectColumn_guid'
    , @value = 'e0f17926-9d61-eb11-84dc-a81e8446d5b0'
    , @level0type = N'SCHEMA'
    , @level0name = N'sqlparse'
    , @level1type = N'VIEW'
    , @level1name = N'RepoObject_SqlModules_10_statement'
    , @level2type = N'COLUMN'
    , @level2name = N'normalized';
  Go
  
  Execute sp_addextendedproperty
      @name = N'RepoObjectColumn_guid'
    , @value = 'dff17926-9d61-eb11-84dc-a81e8446d5b0'
    , @level0type = N'SCHEMA'
    , @level0name = N'sqlparse'
    , @level1type = N'VIEW'
    , @level1name = N'RepoObject_SqlModules_10_statement'
    , @level2type = N'COLUMN'
    , @level2name = N'is_whitespace';
  Go
  
  Execute sp_addextendedproperty
      @name = N'RepoObjectColumn_guid'
    , @value = 'def17926-9d61-eb11-84dc-a81e8446d5b0'
    , @level0type = N'SCHEMA'
    , @level0name = N'sqlparse'
    , @level1type = N'VIEW'
    , @level1name = N'RepoObject_SqlModules_10_statement'
    , @level2type = N'COLUMN'
    , @level2name = N'is_keyword';
  Go
  
  Execute sp_addextendedproperty
      @name = N'RepoObjectColumn_guid'
    , @value = 'ddf17926-9d61-eb11-84dc-a81e8446d5b0'
    , @level0type = N'SCHEMA'
    , @level0name = N'sqlparse'
    , @level1type = N'VIEW'
    , @level1name = N'RepoObject_SqlModules_10_statement'
    , @level2type = N'COLUMN'
    , @level2name = N'is_group';
  Go
  
  Execute sp_addextendedproperty
      @name = N'RepoObjectColumn_guid'
    , @value = 'dcf17926-9d61-eb11-84dc-a81e8446d5b0'
    , @level0type = N'SCHEMA'
    , @level0name = N'sqlparse'
    , @level1type = N'VIEW'
    , @level1name = N'RepoObject_SqlModules_10_statement'
    , @level2type = N'COLUMN'
    , @level2name = N'class';
  Go
  
  Execute sp_addextendedproperty
      @name = N'RepoObjectColumn_guid'
    , @value = 'e1f17926-9d61-eb11-84dc-a81e8446d5b0'
    , @level0type = N'SCHEMA'
    , @level0name = N'sqlparse'
    , @level1type = N'VIEW'
    , @level1name = N'RepoObject_SqlModules_10_statement'
    , @level2type = N'COLUMN'
    , @level2name = N'children';
  Go
  
  Go
  
  EXECUTE sp_addextendedproperty @name = N'ReferencedObjectColumnList', @value = N'* [repo].[RepoObject].[SysObject_fullname]', @level0type = N'SCHEMA', @level0name = N'sqlparse', @level1type = N'VIEW', @level1name = N'RepoObject_SqlModules_10_statement', @level2type = N'COLUMN', @level2name = N'SysObject_fullname';
  
  
  Go
  
  
  Go
  
  EXECUTE sp_addextendedproperty @name = N'ReferencedObjectColumnList', @value = N'* [sqlparse].[RepoObject_SqlModules].[sql_modules_json]', @level0type = N'SCHEMA', @level0name = N'sqlparse', @level1type = N'VIEW', @level1name = N'RepoObject_SqlModules_10_statement', @level2type = N'COLUMN', @level2name = N'sql_modules_json';
  
  
  Go
  
  EXECUTE sp_addextendedproperty @name = N'ReferencedObjectColumnList', @value = N'* [sqlparse].[RepoObject_SqlModules].[RepoObject_guid]', @level0type = N'SCHEMA', @level0name = N'sqlparse', @level1type = N'VIEW', @level1name = N'RepoObject_SqlModules_10_statement', @level2type = N'COLUMN', @level2name = N'RepoObject_guid';
  
  
  
  GO
  EXECUTE sp_addextendedproperty @name = N'ReferencedObjectList', @value = N'* [repo].[RepoObject]
  * [sqlparse].[RepoObject_SqlModules]', @level0type = N'SCHEMA', @level0name = N'sqlparse', @level1type = N'VIEW', @level1name = N'RepoObject_SqlModules_10_statement';
  
  
  GO
  
  
  
  GO
  
  
  
  GO
  
  
  
  GO
  
  
  
  GO
  EXECUTE sp_addextendedproperty @name = N'AntoraReferencingList', @value = N'* xref:sqlparse.RepoObject_SqlModules_20_statement_children.adoc[]', @level0type = N'SCHEMA', @level0name = N'sqlparse', @level1type = N'VIEW', @level1name = N'RepoObject_SqlModules_10_statement';
  
  
  GO
  EXECUTE sp_addextendedproperty @name = N'AntoraReferencedList', @value = N'* xref:repo.RepoObject.adoc[]
  * xref:sqlparse.RepoObject_SqlModules.adoc[]', @level0type = N'SCHEMA', @level0name = N'sqlparse', @level1type = N'VIEW', @level1name = N'RepoObject_SqlModules_10_statement';
  
  
  GO
  EXECUTE sp_addextendedproperty @name = N'is_ssas', @value = N'0', @level0type = N'SCHEMA', @level0name = N'sqlparse', @level1type = N'VIEW', @level1name = N'RepoObject_SqlModules_10_statement';
  
  
  GO
  EXECUTE sp_addextendedproperty @name = N'is_repo_managed', @value = N'0', @level0type = N'SCHEMA', @level0name = N'sqlparse', @level1type = N'VIEW', @level1name = N'RepoObject_SqlModules_10_statement';
  
  