sqlparse.ftv_sqlparse_with_some_children - IF

type: IF ( inline function ), modify_date: 2021-04-13 19:02:37

RepoObject_guid: 2F90291C-9D61-EB11-84DC-A81E8446D5B0

Description

Examples

Parameters

  • @json_array (nvarchar(max))

Entity Diagram

entity-sqlparse.ftv_sqlparse_with_some_children

Columns

Table 1. Columns of sqlparse.ftv_sqlparse_with_some_children - IF
PK Column Name Data Type NULL? ID

nvarchar(max)

NULL

nvarchar(500)

NULL

bit

NULL

bit

NULL

bit

NULL

nvarchar(max)

NULL

nvarchar(max)

NULL

nvarchar(500)

NULL

bit

NULL

bit

NULL

bit

NULL

nvarchar(max)

NULL

nvarchar(max)

NULL

nvarchar(500)

NULL

bit

NULL

bit

NULL

bit

NULL

nvarchar(max)

NULL

nvarchar(max)

NULL

nvarchar(500)

NULL

bit

NULL

bit

NULL

bit

NULL

nvarchar(max)

NULL

nvarchar(max)

NULL

nvarchar(500)

NULL

bit

NULL

bit

NULL

bit

NULL

nvarchar(max)

NULL

nvarchar(max)

NULL

nvarchar(500)

NULL

bit

NULL

bit

NULL

bit

NULL

nvarchar(4000)

NOT NULL

nvarchar(max)

NULL

References

Object Reference Diagram - 1 1

entity_1_1_objectref-sqlparse.ftv_sqlparse_with_some_children

Object Reference Diagram - Referenced - 30 0

entity_30_0_objectref-sqlparse.ftv_sqlparse_with_some_children

Object Reference Diagram - Referencing - 0 30

entity_0_30_objectref-sqlparse.ftv_sqlparse_with_some_children

Column Reference Diagram

entity_1_1_colref-sqlparse.ftv_sqlparse_with_some_children

Column Details

_

child0_children

child0_children

nvarchar(max)

NULL

child0_class

child0_class

nvarchar(500)

NULL

child0_is_group

child0_is_group

bit

NULL

child0_is_keyword

child0_is_keyword

bit

NULL

child0_is_whitespace

child0_is_whitespace

bit

NULL

child0_normalized

child0_normalized

nvarchar(max)

NULL

child1_children

child1_children

nvarchar(max)

NULL

child1_class

child1_class

nvarchar(500)

NULL

child1_is_group

child1_is_group

bit

NULL

child1_is_keyword

child1_is_keyword

bit

NULL

child1_is_whitespace

child1_is_whitespace

bit

NULL

child1_normalized

child1_normalized

nvarchar(max)

NULL

child2_children

child2_children

nvarchar(max)

NULL

child2_class

child2_class

nvarchar(500)

NULL

child2_is_group

child2_is_group

bit

NULL

child2_is_keyword

child2_is_keyword

bit

NULL

child2_is_whitespace

child2_is_whitespace

bit

NULL

child2_normalized

child2_normalized

nvarchar(max)

NULL

child3_children

child3_children

nvarchar(max)

NULL

child3_class

child3_class

nvarchar(500)

NULL

child3_is_group

child3_is_group

bit

NULL

child3_is_keyword

child3_is_keyword

bit

NULL

child3_is_whitespace

child3_is_whitespace

bit

NULL

child3_normalized

child3_normalized

nvarchar(max)

NULL

child4_children

child4_children

nvarchar(max)

NULL

child4_class

child4_class

nvarchar(500)

NULL

child4_is_group

child4_is_group

bit

NULL

child4_is_keyword

child4_is_keyword

bit

NULL

child4_is_whitespace

child4_is_whitespace

bit

NULL

child4_normalized

child4_normalized

nvarchar(max)

NULL

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

sql_modules_definition

sqlparse.ftv_sqlparse_with_some_children - IF script
CREATE Function [sqlparse].ftv_sqlparse_with_some_children
(
    @json_array NVarchar(Max)
)
Returns Table
As
Return
(
    Select
        j1.[Key] As json_key
      , j2.*
    From
        OpenJson ( @json_array ) j1
        Cross Apply
        OpenJson ( j1.Value )
        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
          --get values of some children
          --children[0] is the first children
          , child0_class NVarchar ( 500 ) N'$.children[0].class'
          , child0_is_group Bit N'$.children[0].is_group'
          , child0_is_keyword Bit N'$.children[0].is_keyword'
          , child0_is_whitespace Bit N'$.children[0].is_whitespace'
          , child0_normalized NVarchar ( Max ) N'$.children[0].normalized'
          , child0_children NVarchar ( Max ) N'$.children[0].children' As Json
          , child1_class NVarchar ( 500 ) N'$.children[1].class'
          , child1_is_group Bit N'$.children[1].is_group'
          , child1_is_keyword Bit N'$.children[1].is_keyword'
          , child1_is_whitespace Bit N'$.children[1].is_whitespace'
          , child1_normalized NVarchar ( Max ) N'$.children[1].normalized'
          , child1_children NVarchar ( Max ) N'$.children[1].children' As Json
          , child2_class NVarchar ( 500 ) N'$.children[2].class'
          , child2_is_group Bit N'$.children[2].is_group'
          , child2_is_keyword Bit N'$.children[2].is_keyword'
          , child2_is_whitespace Bit N'$.children[2].is_whitespace'
          , child2_normalized NVarchar ( Max ) N'$.children[2].normalized'
          , child2_children NVarchar ( Max ) N'$.children[2].children' As Json
          , child3_class NVarchar ( 500 ) N'$.children[3].class'
          , child3_is_group Bit N'$.children[3].is_group'
          , child3_is_keyword Bit N'$.children[3].is_keyword'
          , child3_is_whitespace Bit N'$.children[3].is_whitespace'
          , child3_normalized NVarchar ( Max ) N'$.children[3].normalized'
          , child3_children NVarchar ( Max ) N'$.children[3].children' As Json
          , child4_class NVarchar ( 500 ) N'$.children[4].class'
          , child4_is_group Bit N'$.children[4].is_group'
          , child4_is_keyword Bit N'$.children[4].is_keyword'
          , child4_is_whitespace Bit N'$.children[4].is_whitespace'
          , child4_normalized NVarchar ( Max ) N'$.children[4].normalized'
          , child4_children NVarchar ( Max ) N'$.children[4].children' As Json
        )                        j2
);