sqlparse.RepoObject_SqlModules_Repo_Sys - V

type: V ( view ), modify_date: 2021-08-17 20:17:47

RepoObject_guid: 5390291C-9D61-EB11-84DC-A81E8446D5B0

Description

Examples

Entity Diagram

entity-sqlparse.repoobject_sqlmodules_repo_sys

Columns

Table 1. Columns of sqlparse.RepoObject_SqlModules_Repo_Sys - V
PK Column Name Data Type NULL? ID

int

NULL

bit

NULL

datetime

NOT NULL

uniqueidentifier

NOT NULL

nvarchar(max)

NULL

datetime

NULL

nvarchar(max)

NULL

nvarchar(max)

NULL

nvarchar(max)

NULL

char(2)

NULL

Foreign Key Diagram

entity_1_1_fk-sqlparse.repoobject_sqlmodules_repo_sys

References

Object Reference Diagram - 1 1

entity_1_1_objectref-sqlparse.repoobject_sqlmodules_repo_sys

Object Reference Diagram - Referenced - 30 0

entity_30_0_objectref-sqlparse.repoobject_sqlmodules_repo_sys

Object Reference Diagram - Referencing - 0 30

entity_0_30_objectref-sqlparse.repoobject_sqlmodules_repo_sys

Column Reference Diagram

entity_1_1_colref-sqlparse.repoobject_sqlmodules_repo_sys

Indexes

idx_RepoObject_SqlModules_Repo_Sys__1

Column Details

_

is_json_sql_modules_json

is_json_sql_modules_json

int

NULL

Description

(isjson([sql_modules_json]))


is_outdated

is_outdated

bit

NULL

modify_date

modify_date

datetime

NOT NULL

Referenced Columns

RepoObject_guid

RepoObject_guid

uniqueidentifier

NOT NULL

Referenced Columns

sql_modules_definition

sql_modules_definition

nvarchar(max)

NULL

sql_modules_dt

sql_modules_dt

datetime

NULL

sql_modules_formatted

sql_modules_formatted

nvarchar(max)

NULL

sql_modules_formatted2

sql_modules_formatted2

nvarchar(max)

NULL

sql_modules_json

sql_modules_json

nvarchar(max)

NULL

SysObject_type

SysObject_type

char(2)

NULL

Referenced Columns

sql_modules_definition

sqlparse.RepoObject_SqlModules_Repo_Sys - V script
CREATE View sqlparse.RepoObject_SqlModules_Repo_Sys
As
--
Select
    ro.RepoObject_guid
  ----when outdated, use original [sql_modules_definition], otherwise use saved [sql_modules_definition]
  --, [sql_modules_definition] = CASE
  -- WHEN (
  --   [ros].[sql_modules_dt] IS NULL
  --   OR [ros].[sql_modules_dt] < [so].[modify_date]
  --   )
  --  THEN [so].[sql_modules_definition]
  -- ELSE [ros].[sql_modules_definition]
  -- END
  , so.sql_modules_definition
  , ros.sql_modules_dt
  --, [ros].[sql_modules_antora]
  , ros.sql_modules_formatted
  , ros.sql_modules_formatted2
  , ros.sql_modules_json
  , ros.is_json_sql_modules_json
  , so.modify_date
  , ro.SysObject_type
  , is_outdated = Cast(Case
                           When
                           (
                               ros.sql_modules_dt Is Null
                               Or ros.sql_modules_dt < so.modify_date
                           )
                               Then
                               1
                           Else
                               0
                       End As Bit)
From
    repo.RepoObject                    As ro
    Inner Join
        repo_sys.SysObject             As so
            On
            --ro.RepoObject_guid  = so.SysObject_RepoObject_guid
            so.SysObject_fullname2 = ro.SysObject_fullname2

    Left Join
        sqlparse.RepoObject_SqlModules As ros
            On
            ros.RepoObject_guid    = ro.RepoObject_guid
Where
    Not so.sql_modules_definition Is Null