ssas.model_json_331_dataSources_annotations - V

type: V ( view ), modify_date: 2021-09-01 06:41:44

RepoObject_guid: FB5FD8EE-E90A-EC11-8516-A81E8446D5B0

Description

Examples

Entity Diagram

entity-ssas.model_json_331_datasources_annotations

Columns

Table 1. Columns of ssas.model_json_331_dataSources_annotations - V
PK Column Name Data Type NULL? ID

1

nvarchar(128)

NOT NULL

2

nvarchar(500)

NULL

3

nvarchar(500)

NULL

nvarchar(max)

NULL

nvarchar(max)

NULL

Foreign Key Diagram

entity_1_1_fk-ssas.model_json_331_datasources_annotations

References

Object Reference Diagram - 1 1

entity_1_1_objectref-ssas.model_json_331_datasources_annotations

Object Reference Diagram - Referenced - 30 0

entity_30_0_objectref-ssas.model_json_331_datasources_annotations

Object Reference Diagram - Referencing - 0 30

entity_0_30_objectref-ssas.model_json_331_datasources_annotations

Column Reference Diagram

entity_1_1_colref-ssas.model_json_331_datasources_annotations

Indexes

PK_model_json_331_dataSources_annotations

idx_model_json_331_dataSources_annotations__2

idx_model_json_331_dataSources_annotations__3

Column Details

_

databasename

1

databasename

nvarchar(128)

NOT NULL

dataSources_name

2

dataSources_name

nvarchar(500)

NULL

dataSources_annotations_name

3

dataSources_annotations_name

nvarchar(500)

NULL

dataSources_annotations_value

dataSources_annotations_value

nvarchar(max)

NULL

dataSources_annotations_value_ja

dataSources_annotations_value_ja

nvarchar(max)

NULL

sql_modules_definition

ssas.model_json_331_dataSources_annotations - V script
/*
--get and check existing values

Select
    Distinct
    j2.[Key]
  , j2.Type
From
    ssas.model_json_33_dataSources                         As T1
    Cross Apply OpenJson ( T1.dataSources_annotations_ja ) As j1
    Cross Apply OpenJson ( j1.Value ) As j2
order by
    j2.[Key]
  , j2.Type
Go

Select
    T1.*
  , j2.*
From
    ssas.model_json_33_dataSources                         As T1
    Cross Apply OpenJson ( T1.dataSources_annotations_ja ) As j1
    Cross Apply OpenJson ( j1.Value ) As j2
Go

Select
    DISTINCT
    j2.*
From
    ssas.model_json_33_dataSources                         As T1
    Cross Apply OpenJson ( T1.dataSources_annotations_ja ) As j1
    Cross Apply OpenJson ( j1.Value ) As j2
Where
    j2.[Key] = 'value'
GO
*/
CREATE View ssas.model_json_331_dataSources_annotations
As
Select
    T1.databasename
  , T1.dataSources_name
  , j2.dataSources_annotations_name
  , j2.dataSources_annotations_value
  , j2.dataSources_annotations_value_ja
From
    ssas.model_json_33_dataSources                         As T1
    Cross Apply OpenJson ( T1.dataSources_annotations_ja ) As j1
    Cross Apply
    OpenJson ( j1.Value )
    With
    (
        dataSources_annotations_name NVarchar ( 500 ) N'$.name'
      , dataSources_annotations_value NVarchar ( Max ) N'$.value'
      , dataSources_annotations_value_ja NVarchar ( Max ) N'$.value' As Json --currently no array in my data
    ) As j2