sqlparse.ftv_sqlparse - IF

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

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

Description

Examples

Parameters

  • @json_array (nvarchar(max))

Entity Diagram

entity-sqlparse.ftv_sqlparse

Columns

Table 1. Columns of sqlparse.ftv_sqlparse - IF
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

References

Object Reference Diagram - 1 1

entity_1_1_objectref-sqlparse.ftv_sqlparse

Object Reference Diagram - Referenced - 30 0

entity_30_0_objectref-sqlparse.ftv_sqlparse

Object Reference Diagram - Referencing - 0 30

entity_0_30_objectref-sqlparse.ftv_sqlparse

Column Reference Diagram

entity_1_1_colref-sqlparse.ftv_sqlparse

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

sql_modules_definition

sqlparse.ftv_sqlparse - IF script
CREATE Function [sqlparse].ftv_sqlparse
(
    @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
        )                        j2
);