sqlparse.ftv_sqlparse_children_pivot - IF

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

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

Description

Examples

Parameters

  • @json_array (nvarchar(max))

Entity Diagram

entity-sqlparse.ftv_sqlparse_children_pivot

Columns

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

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

nvarchar(4000)

NULL

References

Object Reference Diagram - 1 1

entity_1_1_objectref-sqlparse.ftv_sqlparse_children_pivot

Object Reference Diagram - Referenced - 30 0

entity_30_0_objectref-sqlparse.ftv_sqlparse_children_pivot

Object Reference Diagram - Referencing - 0 30

entity_0_30_objectref-sqlparse.ftv_sqlparse_children_pivot

Column Reference Diagram

entity_1_1_colref-sqlparse.ftv_sqlparse_children_pivot

Column Details

_

child0_children

child0_children

nvarchar(4000)

NULL

child0_class

child0_class

nvarchar(4000)

NULL

child0_is_group

child0_is_group

nvarchar(4000)

NULL

child0_is_keyword

child0_is_keyword

nvarchar(4000)

NULL

child0_normalized

child0_normalized

nvarchar(4000)

NULL

child1_children

child1_children

nvarchar(4000)

NULL

child1_class

child1_class

nvarchar(4000)

NULL

child1_is_group

child1_is_group

nvarchar(4000)

NULL

child1_is_keyword

child1_is_keyword

nvarchar(4000)

NULL

child1_normalized

child1_normalized

nvarchar(4000)

NULL

child2_children

child2_children

nvarchar(4000)

NULL

child2_class

child2_class

nvarchar(4000)

NULL

child2_is_group

child2_is_group

nvarchar(4000)

NULL

child2_is_keyword

child2_is_keyword

nvarchar(4000)

NULL

child2_normalized

child2_normalized

nvarchar(4000)

NULL

child3_children

child3_children

nvarchar(4000)

NULL

child3_class

child3_class

nvarchar(4000)

NULL

child3_is_group

child3_is_group

nvarchar(4000)

NULL

child3_is_keyword

child3_is_keyword

nvarchar(4000)

NULL

child3_normalized

child3_normalized

nvarchar(4000)

NULL

child4_children

child4_children

nvarchar(4000)

NULL

child4_class

child4_class

nvarchar(4000)

NULL

child4_is_group

child4_is_group

nvarchar(4000)

NULL

child4_is_keyword

child4_is_keyword

nvarchar(4000)

NULL

child4_normalized

child4_normalized

nvarchar(4000)

NULL

sql_modules_definition

sqlparse.ftv_sqlparse_children_pivot - IF script
/*
--test

declare @json_array nvarchar(max)
set @json_array =
'
[{"class": "Token", "ttype": ["Name"], "is_group": false, "str": "[T1]", "normalized": "[T1]", "is_keyword": false, "is_whitespace": false, "children": []}, {"class": "Token", "ttype": ["Punctuation"], "is_group": false, "str": ".", "normalized": ".", "is_keyword": false, "is_whitespace": false, "children": []}, {"class": "Token", "ttype": ["Name"], "is_group": false, "str": "[Active]", "normalized": "[Active]", "is_keyword": false, "is_whitespace": false, "children": []}]
'

SELECT * from [repo].[ftv_sqlparse_children_pivot](@json_array)

*/
CREATE Function [sqlparse].ftv_sqlparse_children_pivot
(
    @json_array NVarchar(Max)
)
Returns Table
As
Return
(
    Select
        child0_class      = Json_Value ( @json_array, '$[0].class' )
      , child0_is_group   = Json_Value ( @json_array, '$[0].is_group' )
      , child0_is_keyword = Json_Value ( @json_array, '$[0].is_keyword' )
      , child0_normalized = Json_Value ( @json_array, '$[0].normalized' )
      , child0_children   = Json_Value ( @json_array, '$[0].children' )
      , child1_class      = Json_Value ( @json_array, '$[1].class' )
      , child1_is_group   = Json_Value ( @json_array, '$[1].is_group' )
      , child1_is_keyword = Json_Value ( @json_array, '$[1].is_keyword' )
      , child1_normalized = Json_Value ( @json_array, '$[1].normalized' )
      , child1_children   = Json_Value ( @json_array, '$[1].children' )
      , child2_class      = Json_Value ( @json_array, '$[2].class' )
      , child2_is_group   = Json_Value ( @json_array, '$[2].is_group' )
      , child2_is_keyword = Json_Value ( @json_array, '$[2].is_keyword' )
      , child2_normalized = Json_Value ( @json_array, '$[2].normalized' )
      , child2_children   = Json_Value ( @json_array, '$[2].children' )
      , child3_class      = Json_Value ( @json_array, '$[3].class' )
      , child3_is_group   = Json_Value ( @json_array, '$[3].is_group' )
      , child3_is_keyword = Json_Value ( @json_array, '$[3].is_keyword' )
      , child3_normalized = Json_Value ( @json_array, '$[3].normalized' )
      , child3_children   = Json_Value ( @json_array, '$[3].children' )
      , child4_class      = Json_Value ( @json_array, '$[4].class' )
      , child4_is_group   = Json_Value ( @json_array, '$[4].is_group' )
      , child4_is_keyword = Json_Value ( @json_array, '$[4].is_keyword' )
      , child4_normalized = Json_Value ( @json_array, '$[4].normalized' )
      , child4_children   = Json_Value ( @json_array, '$[4].children' )
);