diff --git a/DBG - get all indexes of a tables size.sql b/DBG - get all indexes of a tables size.sql
new file mode 100644
index 0000000..76ef334
--- /dev/null
+++ b/DBG - get all indexes of a tables size.sql
@@ -0,0 +1,9 @@
+SELECT
+ i.name AS IndexName,
+ SUM(s.used_page_count) * 8 /1024 AS IndexSizeMB
+FROM sys.dm_db_partition_stats AS s
+JOIN sys.indexes AS i
+ON s.[object_id] = i.[object_id] AND s.index_id = i.index_id
+WHERE s.[object_id] = object_id('dbo.document_line')
+GROUP BY i.name
+ORDER BY i.name
\ No newline at end of file
diff --git a/DBG - index infos.sql b/DBG - index infos.sql
new file mode 100644
index 0000000..cc383a2
--- /dev/null
+++ b/DBG - index infos.sql
@@ -0,0 +1,136 @@
+;WITH ColInfo
+ AS (SELECT TblName = o.name,
+ SchemaTbl = s.name + '.' + o.name,
+ IndexName = i.name,
+ IsPrimaryKey = [i].[is_primary_key],
+ IsUniqueConstraint = [i].[is_unique_constraint],
+ IsUnique = [i].[is_unique],
+ ColName = c.name,
+ IsComputedCol = [c].[is_computed],
+ IsIncludedCol = [ic].[is_included_column],
+ [ic].[key_ordinal],
+ FilterDefinition = [i].[filter_definition],
+ i.[index_id],
+ crlf = CHAR(13) + CHAR(10),
+ crlfgo = ';' + CHAR(13) + CHAR(10) + 'GO' + CHAR(13) + CHAR(10),
+ [o].[object_id]
+ FROM sys.objects o
+ INNER JOIN sys.schemas s
+ ON o.schema_id = s.schema_id
+ INNER JOIN sys.columns c
+ ON o.object_id = c.object_id
+ INNER JOIN sys.indexes i
+ ON c.object_id = i.object_id
+ INNER JOIN sys.index_columns ic
+ ON i.index_id = ic.index_id
+ AND o.object_id = ic.object_id
+ AND c.column_id = ic.column_id
+ WHERE s.name = 'dbo'
+ AND o.name = 'item_key'
+--AND i.filter_definition IS NOT NULL
+)
+SELECT DISTINCT [x].[TblName],
+ [x].[IndexName],
+ [x].[index_id],
+ [x].[IsPrimaryKey],
+ [x].[IsUniqueConstraint],
+ [x].[IsUnique],
+ --,size.IndexSizeKB
+ [c].[IndexColumns],
+ [ci].[IncludedColumns],
+ [cc].[ComputedColumns],
+ [x].[FilterDefinition],
+ [sz].[IndexSizeMB],
+ [us].[Reads],
+ [us].[Writes],
+ DropCreateSQL = [x].[crlf] + '-- ' + x.IndexName + [x].[crlf] +
+ --check drop
+ 'IF INDEXPROPERTY(OBJECT_ID(''' + [x].[SchemaTbl] + '''), ''' + x.IndexName
+ + ''' , ''IndexID'' ) IS NOT NULL BEGIN;' + [x].[crlf]
+ + CASE
+ WHEN [x].[IsPrimaryKey] = 1 THEN NULL
+ WHEN [x].[IsUniqueConstraint] = 1 THEN
+ --drop statement
+ ' ALTER TABLE ' + [x].[SchemaTbl] + ' DROP CONSTRAINT ' + x.IndexName + ';'
+ + [x].[crlf] + 'END' + [x].[crlfgo]
+ --check create
+ + 'IF INDEXPROPERTY(OBJECT_ID(''' + [x].[SchemaTbl] + '''), ''' + x.IndexName
+ + ''' , ''IndexID'' ) IS NULL BEGIN;' + [x].[crlf] +
+ --create statement
+ +' ALTER TABLE '
+ + [x].[SchemaTbl] + ' ADD CONSTRAINT ' + x.IndexName + ' UNIQUE ('
+ + [c].[IndexColumns] + ');' + [x].[crlf] + 'END' + [x].[crlfgo]
+ ELSE
+ --drop statement
+ ' DROP INDEX ' + [x].[SchemaTbl] + '.' + x.IndexName + ';' + [x].[crlf]
+ + 'END' + [x].[crlfgo]
+ --check create
+ + 'IF INDEXPROPERTY(OBJECT_ID(''' + [x].[SchemaTbl] + '''), ''' + x.IndexName
+ + ''' , ''IndexID'' ) IS NULL BEGIN;' + [x].[crlf] +
+ --create statement
+ +' CREATE '
+ + CASE
+ WHEN [x].[IsUnique] = 1 THEN 'UNIQUE '
+ ELSE '' END + 'INDEX ' + x.IndexName + ' ON ' + [x].[SchemaTbl] + '('
+ + [c].[IndexColumns] + ')'
+ + ISNULL(' INCLUDE(' + [ci].[IncludedColumns] + ')', '')
+ + ISNULL(' WHERE ' + [x].[FilterDefinition], '') + ';' + [x].[crlf] + 'END'
+ + [x].[crlfgo] END
+ FROM ColInfo x
+ OUTER APPLY ( SELECT IndexColumns = STUFF([sq].[strXML], 1, 2, '')
+ FROM ( SELECT ', ' + ISNULL([x2].[ColName], '')
+ FROM ColInfo x2
+ WHERE x.TblName = [x2].[TblName]
+ AND x.IndexName = [x2].[IndexName]
+ AND [x2].[IsIncludedCol] = 0
+ ORDER BY x2.key_ordinal
+ FOR XML PATH('')) sq(strXML) ) c
+ OUTER APPLY ( SELECT IncludedColumns = STUFF([sq].[strXML], 1, 2, '')
+ FROM ( SELECT ', ' + ISNULL([x2].[ColName], '')
+ FROM ColInfo x2
+ WHERE x.TblName = [x2].[TblName]
+ AND x.IndexName = [x2].[IndexName]
+ AND [x2].[IsIncludedCol] = 1
+ ORDER BY x2.key_ordinal
+ FOR XML PATH('')) sq(strXML) ) ci
+ OUTER APPLY ( SELECT ComputedColumns = STUFF([sq].[strXML], 1, 2, '')
+ FROM ( SELECT ', ' + ISNULL([x2].[ColName], '')
+ FROM ColInfo x2
+ WHERE x.TblName = [x2].[TblName]
+ AND x.IndexName = [x2].[IndexName]
+ AND [x2].[IsComputedCol] = 1
+ ORDER BY x2.key_ordinal
+ FOR XML PATH('')) sq(strXML) ) cc
+ OUTER APPLY ( SELECT tblName = o.name,
+ o.type,
+ i.name AS [IndexName],
+ i.index_id,
+ [s].[user_seeks] + [s].[user_scans] + [s].[user_lookups] AS [Reads],
+ [s].[user_updates] AS [Writes],
+ i.type_desc AS [IndexType],
+ [i].[fill_factor] AS [FillFactor],
+ [i].[has_filter],
+ [i].[filter_definition],
+ [s].[last_user_scan],
+ [s].[last_user_lookup],
+ [s].[last_user_seek]
+ FROM sys.dm_db_index_usage_stats AS s WITH (NOLOCK)
+ INNER JOIN sys.indexes AS i WITH (NOLOCK)
+ ON s.object_id = i.object_id
+ INNER JOIN sys.objects o WITH (NOLOCK)
+ ON s.object_id = o.object_id
+ WHERE o.type = 'U' -- user table
+ AND i.index_id = s.index_id
+ AND [s].[database_id] = DB_ID()
+ AND o.name = x.TblName
+ AND i.name = x.IndexName) us
+ OUTER APPLY ( SELECT [i].[name] AS IndexName,
+ SUM([s].[used_page_count]) * 8 / 1024 AS IndexSizeMB
+ FROM sys.dm_db_partition_stats AS s
+ JOIN sys.indexes AS i
+ ON s.[object_id] = i.[object_id]
+ AND s.index_id = i.index_id
+ WHERE s.[object_id] = x.[object_id] --OBJECT_ID('dbo.document_line')
+ AND [i].[name] = x.IndexName
+ GROUP BY [i].[name]) sz
+ORDER BY [x].[index_id];
diff --git a/EXPLOIT - suspect database.sql b/EXPLOIT - suspect database.sql
new file mode 100644
index 0000000..c453d7d
--- /dev/null
+++ b/EXPLOIT - suspect database.sql
@@ -0,0 +1,12 @@
+--step 1, go in emergency mode
+ALTER database [ActivePos_write] set SINGLE_USER
+Alter database [ActivePos_write] SET EMERGENCY
+
+--step 2, do a checkdb
+DBCC CHECKDB ('ActivePos_write') WITH NO_INFOMSGS, ALL_ERRORMSGS
+
+--if no errors reported or index corruption, do a repair with data loss
+DBCC CHECKDB ('ActivePos_write', REPAIR_ALLOW_DATA_LOSS)
+
+--set the db back in multi user
+ALTER database [ActivePos_write] set multi_user
\ No newline at end of file
diff --git a/OCTPDBA-494 - Triafin SSRS report performances/.vs/OCTPDBA-494 - Triafin SSRS report performances/v15/.ssms_suo b/OCTPDBA-494 - Triafin SSRS report performances/.vs/OCTPDBA-494 - Triafin SSRS report performances/v15/.ssms_suo
new file mode 100644
index 0000000..59ba876
Binary files /dev/null and b/OCTPDBA-494 - Triafin SSRS report performances/.vs/OCTPDBA-494 - Triafin SSRS report performances/v15/.ssms_suo differ
diff --git a/OCTPDBA-494 - Triafin SSRS report performances/OCTPDBA-494 - Triafin SSRS report performances.ssmssln b/OCTPDBA-494 - Triafin SSRS report performances/OCTPDBA-494 - Triafin SSRS report performances.ssmssln
new file mode 100644
index 0000000..d7a2ea7
--- /dev/null
+++ b/OCTPDBA-494 - Triafin SSRS report performances/OCTPDBA-494 - Triafin SSRS report performances.ssmssln
@@ -0,0 +1,21 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# SQL Server Management Studio Solution File, Format Version 18.00
+VisualStudioVersion = 15.0.28307.421
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{4F2E2C19-372F-40D8-9FA7-9D2138C6997A}") = "OCTPDBA-494 - Triafin SSRS report performances", "OCTPDBA-494 - Triafin SSRS report performances\OCTPDBA-494 - Triafin SSRS report performances.ssmssqlproj", "{0C4A7033-F9D6-4FD3-B281-46AF32E3A3AE}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Default|Default = Default|Default
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {0C4A7033-F9D6-4FD3-B281-46AF32E3A3AE}.Default|Default.ActiveCfg = Default
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {376F0692-F108-41FE-AE3C-E5C5A15D65E9}
+ EndGlobalSection
+EndGlobal
diff --git a/OCTPDBA-494 - Triafin SSRS report performances/OCTPDBA-494 - Triafin SSRS report performances/OCTPDBA-494 - Triafin SSRS report performances.ssmssqlproj b/OCTPDBA-494 - Triafin SSRS report performances/OCTPDBA-494 - Triafin SSRS report performances/OCTPDBA-494 - Triafin SSRS report performances.ssmssqlproj
new file mode 100644
index 0000000..25cfc75
--- /dev/null
+++ b/OCTPDBA-494 - Triafin SSRS report performances/OCTPDBA-494 - Triafin SSRS report performances/OCTPDBA-494 - Triafin SSRS report performances.ssmssqlproj
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OCTPDBA-565 manage index 23.2/.vs/OCTPDBA-565 manage index 23.2/v15/.ssms_suo b/OCTPDBA-565 manage index 23.2/.vs/OCTPDBA-565 manage index 23.2/v15/.ssms_suo
new file mode 100644
index 0000000..555b04a
Binary files /dev/null and b/OCTPDBA-565 manage index 23.2/.vs/OCTPDBA-565 manage index 23.2/v15/.ssms_suo differ
diff --git a/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2.ssmssln b/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2.ssmssln
new file mode 100644
index 0000000..fb51550
--- /dev/null
+++ b/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2.ssmssln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# SQL Server Management Studio Solution File, Format Version 18.00
+VisualStudioVersion = 15.0.28307.421
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{4F2E2C19-372F-40D8-9FA7-9D2138C6997A}") = "OCTPDBA-565 manage index 23.2", "OCTPDBA-565 manage index 23.2\OCTPDBA-565 manage index 23.2.ssmssqlproj", "{C97024D6-51B8-45F5-AB85-2F078896231D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Default|Default = Default|Default
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {C97024D6-51B8-45F5-AB85-2F078896231D}.Default|Default.ActiveCfg = Default
+ {4513A253-D07C-4788-BECD-EE9E137E12C6}.Default|Default.ActiveCfg = Default
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {E928451A-DEEA-4C89-9EBD-4E5A6C689ED5}
+ EndGlobalSection
+EndGlobal
diff --git a/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2.ssmssqlproj b/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2.ssmssqlproj
new file mode 100644
index 0000000..e0a0735
--- /dev/null
+++ b/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2.ssmssqlproj
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+ 2023-04-21T15:44:01.3213141+02:00
+ SQL
+ (local)
+
+ Windows Authentication
+
+ 30
+ 0
+ NotSpecified
+ Microsoft SQL Server Management Studio - Query
+
+
+ 2023-04-21T15:15:13.4922177+02:00
+ SQL
+ suncent
+
+ Windows Authentication
+ master
+ 30
+ 0
+ NotSpecified
+ Microsoft SQL Server Management Studio - Query
+
+
+
+
+
+
+ 8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True
+ (local)
+
+ centrale.sql
+
+
+ 8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True
+ (local)
+
+ pharmacies.sql
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/centrale.sql b/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/centrale.sql
new file mode 100644
index 0000000..6df5700
--- /dev/null
+++ b/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/centrale.sql
@@ -0,0 +1,175 @@
+/*=============================================================================
+
+OCTPDBA-565
+Manage indexes followig 23.2 release branch
+
+Parameters
+----------------------
+
+
+Context
+----------------------
+suncent
+
+Creation : 21.04.2023 / TSC
+Modifications:
+
+=============================================================================*/
+USE arizona
+
+DECLARE @business VARCHAR(20);
+SELECT @business = [Business]
+FROM [master].[cfg].[InstanceContext];
+
+--BEGIN TRANSACTION
+SET XACT_ABORT ON;
+SET NOCOUNT ON;
+
+
+IF @business= 'TPCENT'
+BEGIN
+ /* Item_criteria. drop XIF1041Item_criteria (ITCR_criteria)*/
+ IF EXISTS(
+ SELECT [x].[index_id]
+ FROM [Arizona].[sys].[indexes] x
+ WHERE [x].[name] = 'XIF1041Item_criteria'
+ AND [x].[object_id] = OBJECT_ID('arizona.dbo.Item_criteria')
+ )BEGIN
+ EXEC('use arizona; DROP INDEX dbo.Item_criteria.XIF1041Item_criteria;')
+ PRINT 'drop XIF1041Item_criteria'
+ END
+
+ /* Item_criteria. replace XIF1039Item_criteria with NCIX_Item_criteria_COL_ITCR_item*/
+ IF EXISTS(
+ SELECT [x].[index_id]
+ FROM [Arizona].[sys].[indexes] x
+ WHERE [x].[name] = 'XIF1039Item_criteria'
+ AND [x].[object_id] = OBJECT_ID('arizona.dbo.Item_criteria')
+ )BEGIN
+ EXEC('use arizona; DROP INDEX dbo.Item_criteria.XIF1039Item_criteria;')
+ PRINT 'drop XIF1039Item_criteria'
+ END
+
+ IF NOT EXISTS(
+ SELECT [x].[index_id]
+ FROM [Arizona].[sys].[indexes] x
+ WHERE [x].[name] = 'NCIX_Item_criteria_COL_ITCR_item'
+ AND [x].[object_id] = OBJECT_ID('arizona.dbo.Item_criteria')
+ )BEGIN
+ CREATE NONCLUSTERED INDEX NCIX_Item_criteria_COL_ITCR_item ON [Arizona].[dbo].[Item_criteria]([ITCR_item])
+ INCLUDE([ITCR_criteria]);
+ PRINT 'create NCIX_Item_criteria_COL_ITCR_item'
+ END
+
+ /* Document_line */
+ IF NOT EXISTS(
+ SELECT [x].[index_id]
+ FROM [Arizona].[sys].[indexes] x
+ WHERE [x].[name] = 'NCIX_Document_line_COL_DL_to_be_invoiced'
+ AND [x].[object_id] = OBJECT_ID('arizona.dbo.Document_line')
+ )BEGIN
+ CREATE INDEX [NCIX_Document_line_COL_DL_to_be_invoiced] ON [Arizona].[dbo].[Document_line] ([DL_type], [DL_to_be_invoiced]) INCLUDE ([DL_document_header]);
+ PRINT 'create NCIX_Document_line_COL_DL_to_be_invoiced'
+ END
+
+ /* Fixed_price. */
+ IF NOT EXISTS(
+ SELECT [x].[index_id]
+ FROM [Arizona].[sys].[indexes] x
+ WHERE [x].[name] = 'NCIX_Fixed_price_COL_FP_tariff_type'
+ AND [x].[object_id] = OBJECT_ID('arizona.dbo.Fixed_price')
+ )BEGIN
+ CREATE INDEX [NCIX_Fixed_price_COL_FP_tariff_type] ON [Arizona].[dbo].[Fixed_price] ([FP_tariff_type], [FP_price_code],[FP_start_date]) INCLUDE ([Fixed_price_ID], [FP_item], [FP_end_date], [FP_tax_incl_price_per_unit], [FP_quantity]);
+ PRINT 'create NCIX_Fixed_price_COL_FP_tariff_type'
+ END
+
+ IF NOT EXISTS(
+ SELECT [x].[index_id]
+ FROM [Arizona].[sys].[indexes] x
+ WHERE [x].[name] = 'NCIX_Fixed_price_COL_FP_tariff_type_FP_start_date'
+ AND [x].[object_id] = OBJECT_ID('arizona.dbo.Fixed_price')
+ )BEGIN
+ CREATE INDEX [NCIX_Fixed_price_COL_FP_tariff_type_FP_start_date] ON [Arizona].[dbo].[Fixed_price] ([FP_tariff_type],[FP_start_date]) INCLUDE ([Fixed_price_ID], [FP_item], [FP_price_code], [FP_end_date], [FP_tax_incl_price_per_unit], [FP_quantity]);
+ PRINT 'create xxx'
+ END
+
+ IF NOT EXISTS(
+ SELECT [x].[index_id]
+ FROM [Arizona].[sys].[indexes] x
+ WHERE [x].[name] = 'NCIX_Fixed_price_COL_FP_price_code'
+ AND [x].[object_id] = OBJECT_ID('arizona.dbo.Fixed_price')
+ )BEGIN
+ CREATE INDEX [NCIX_Fixed_price_COL_FP_price_code] ON [Arizona].[dbo].[Fixed_price] ([FP_price_code],[FP_start_date]) INCLUDE ([Fixed_price_ID], [FP_item], [FP_end_date], [FP_tax_incl_price_per_unit]);
+ PRINT 'create NCIX_Fixed_price_COL_FP_price_code'
+ END
+
+ IF NOT EXISTS(
+ SELECT [x].[index_id]
+ FROM [Arizona].[sys].[indexes] x
+ WHERE [x].[name] = 'NCIX_Fixed_price_COL_FP_subsidiary'
+ AND [x].[object_id] = OBJECT_ID('arizona.dbo.Fixed_price')
+ )BEGIN
+ CREATE INDEX [NCIX_Fixed_price_COL_FP_subsidiary] ON [Arizona].[dbo].[Fixed_price] ([FP_subsidiary], [FP_end_date]) INCLUDE ([Fixed_price_ID], [FP_tariff_type], [FP_item], [FP_address], [FP_currency], [FP_price_code], [FP_start_date])
+ PRINT 'create xxx'
+ END
+
+
+ /* item_key */
+ IF NOT EXISTS(
+ SELECT [x].[index_id]
+ FROM [Arizona].[sys].[indexes] x
+ WHERE [x].[name] = 'NCIX_Item_key_COL_ITK_subsidiary'
+ AND [x].[object_id] = OBJECT_ID('arizona.dbo.Item_key')
+ )BEGIN
+ CREATE INDEX [NCIX_Item_key_COL_ITK_subsidiary] ON [Arizona].[dbo].[Item_key] ([ITK_subsidiary], [ITK_type]) INCLUDE ([ITK_item], [ITK_key]);
+ PRINT 'create NCIX_Item_key_COL_ITK_subsidiary'
+ END
+
+ /*Item_statistics_yearly. heap table with no indexes*/
+ IF NOT EXISTS(
+ SELECT [x].[index_id]
+ FROM [Arizona].[sys].[indexes] x
+ WHERE [x].[name] = 'NCIX_Item_statistics_yearly_COL_ITSTAY_item'
+ AND [x].[object_id] = OBJECT_ID('arizona.dbo.Item_statistics_yearly')
+ )BEGIN
+ CREATE INDEX [NCIX_Item_statistics_yearly_COL_ITSTAY_item] ON [Arizona].[dbo].[Item_statistics_yearly] ([ITSTAY_item], [ITSTAY_inventory_type], [ITSTAY_organizational_unit], [ITSTAY_year]) INCLUDE ([Item_statistics_yearly_id]);
+ PRINT 'create NCIX_Item_statistics_yearly_COL_ITSTAY_item'
+ END
+
+ IF NOT EXISTS(
+ SELECT [x].[index_id]
+ FROM [Arizona].[sys].[indexes] x
+ WHERE [x].[name] = 'NCIX_Item_statistics_yearly_COL_ITSTAY_year'
+ AND [x].[object_id] = OBJECT_ID('arizona.dbo.Item_statistics_yearly')
+ )BEGIN
+ CREATE INDEX [NCIX_Item_statistics_yearly_COL_ITSTAY_year] ON [Arizona].[dbo].[Item_statistics_yearly] ([ITSTAY_year]) INCLUDE ([ITSTAY_item], [ITSTAY_inventory_type], [ITSTAY_organizational_unit]);
+ PRINT 'create NCIX_Item_statistics_yearly_COL_ITSTAY_year'
+ END
+
+
+ /*Item_status_history.*/
+ IF NOT EXISTS(
+ SELECT [x].[index_id]
+ FROM [Arizona].[sys].[indexes] x
+ WHERE [x].[name] = 'NCIX_Item_status_history_COL_ITSH_value_date'
+ AND [x].[object_id] = OBJECT_ID('arizona.dbo.Item_status_history')
+ )BEGIN
+ CREATE INDEX [NCIX_Item_status_history_COL_ITSH_value_date] ON [Arizona].[dbo].[Item_status_history] ([ITSH_value_date]) INCLUDE ([ITSH_item], [ITSH_item_context_status]);
+ PRINT 'create NCIX_Item_status_history_COL_ITSH_value_date'
+ END
+
+ /* ------------------------------------------------------ */
+ IF NOT EXISTS(
+ SELECT [x].[index_id]
+ FROM [PharmIndexTP].[sys].[indexes] x
+ WHERE [x].[name] = 'NCIX_mapping_PHGD_CompendiumText_COL_PHGD_CPDTXT_GUID'
+ AND [x].[object_id] = OBJECT_ID('PharmIndexTP.dbo.mapping_PHGD_CompendiumText')
+ )BEGIN
+ CREATE INDEX [NCIX_mapping_PHGD_CompendiumText_COL_PHGD_CPDTXT_GUID] ON [PharmIndexTP].[dbo].[mapping_PHGD_CompendiumText] ([PHGD_CPDTXT_GUID])
+ INCLUDE ([PHGD_CPDTXT_key], [PHGD_CPDTXT_language], [PHGD_CPDTXT_sequence], [PHGD_CPDTXT_text], [PHGD_CPDTXT_status]);
+ PRINT 'create NCIX_mapping_PHGD_CompendiumText_COL_PHGD_CPDTXT_GUID'
+ END
+
+END
+
+--ROLLBACK TRANSACTION
\ No newline at end of file
diff --git a/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/desc.txt b/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/desc.txt
new file mode 100644
index 0000000..8cb3dee
--- /dev/null
+++ b/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/desc.txt
@@ -0,0 +1,232 @@
+/*
+
+octpdba-497 () have removed openrowset to amavitaLiveAPS, everything is centralised now.
+Each procs that have been altered exists with a copy with the suffix "octpdba-497" (typo in some, where the suffix is ctpdba-497).
+The copy with the suffix holds the old code.
+
+
+usage of openrowset on suncent
+ Object name Schema Database Type
+ ABD_Cent_Load dbo ArizonaCUST Procedures
+ ABD_Cent_Load_CTPDBA-497 dbo ArizonaCUST Procedures
+ ACC_Cent_Load dbo ArizonaCUST Procedures
+ ACC_Cent_Load_CTPDBA-497 dbo ArizonaCUST Procedures
+ AP_Cent_Load dbo ArizonaCUST Procedures
+ AP_Cent_Load_OCTPDBA-497 dbo ArizonaCUST Procedures
+ APR_Cent_Load dbo ArizonaCUST Procedures
+ aps_Central_Annual_Inventory_Load dbo ArizonaCUST Procedures
+ aps_GAL_olpFACT_controle_PHA dbo ArizonaCUST Procedures
+ aps_SUN_Cession_Creances dbo ArizonaCUST Procedures
+ aps_SUN_Get_Balanced_Scorecard_Data_From_Central dbo ArizonaCUST Procedures
+ AS_Cent_Load dbo ArizonaCUST Procedures
+ AS_Cent_Load__OCTPDBA-497 dbo ArizonaCUST Procedures
+ AT_Cent_Aggregated_Data_Load dbo ArizonaCUST Procedures
+ AT_Cent_Aggregated_Data_Load_OCTPDBA-497 dbo ArizonaCUST Procedures
+ AT_Cent_Extract_specific_pd_codes dbo ArizonaCUST Procedures
+ AT_Cent_Load dbo ArizonaCUST Procedures
+ CRMCRD_Cent_Load dbo ArizonaCUST Procedures
+ CRMCRD_Cent_Load_OCTPDBA-497 dbo ArizonaCUST Procedures
+ CRSH_Cent_Load dbo ArizonaCUST Procedures
+ CRSO_Cent_Load dbo ArizonaCUST Procedures
+ CRSO_Cent_Load_OCTPDBA-497 dbo ArizonaCUST Procedures
+ DHICI_Cent_Load dbo ArizonaCUST Procedures
+ DHICI_Cent_Load_OCTPDBA-497 dbo ArizonaCUST Procedures
+ FM_Cent_Load dbo ArizonaCUST Procedures
+ ITSC_Cent_Load dbo ArizonaCUST Procedures
+ SSRS_CR_Sales_Select_For_CR_Operation dbo ArizonaCUST Procedures
+ SSRS_Galenicare_Invoice_Payment_List dbo ArizonaCUST Procedures
+
+stuff that stinks:
+ ABD_Cent_Load
+ user sqlSyncAccountingExtractionUsr with it's password in the proc
+
+ ACC_Cent_Load
+ seems that SA passwords are in there.
+ not the actual SA passwords, might be old code that was not adapted
+
+ AP_Cent_Load
+ user sqlSyncAccountingExtractionUsr with it's password in the proc
+
+ AT_Cent_Load
+ Still have a link to AMAVITALIVEAPS
+
+
+
+reports:
+ FidelityCardSales
+ Rapport KO. Son lancement remonte le message suivant
+ An error has occurred during report processing. (rsProcessingAborted)
+ Query execution failed for dataset 'DSMain'. (rsErrorExecutingCommand)
+ Could not find stored procedure 'Extraction_Galenicare_Sales_Fidelity_Card'.
+
+ Lors de la sélection de la "company", lance une query sur Gaia qui retourne toutes les OU de tous les formats ainsi que les "cost centers"
+ ---------------------------
+ with Pharmacy ([Company], [Code], [Code_name]) as
+ (
+ select coalesce(asub.Code, OU_subsidiary_prefix)
+ , OU_code
+ , OU_code + ' ' + OU_short_name
+ from [crs].[vwOrganizationalUnit] ou with (nolock)
+ inner join phar.address_criteria adcr with (nolock)
+ on ou.OU_pharmacy_code = adcr.ADCR_pharmacy_code
+ and ou.OU_address = adcr.ADCR_address
+ inner join phar.criteria cr with (nolock)
+ on adcr.ADCR_criteria = cr.Criteria_ID
+ and adcr.ADCR_pharmacy_code = cr.CR_pharmacy_code
+ inner join [phar].[Criteria_type] crt with (nolock)
+ on cr.CR_criteria_type = crt.Criteria_type_ID
+ and cr.CR_pharmacy_code = crt.CRT_pharmacy_code
+ left join crs.AdditionalSubsidiaryLink asl with (nolock)
+ on ou.Reference_Organizational_unit_ID = asl.OrganizationalUnitId
+ left join crs.AdditionalSubsidiary asub with (nolock)
+ on asl.AdditionalSubsidiaryId = asub.AdditionalSubsidiaryId
+ where crt.CRT_type = 1 and crt.crt_code = 'ENV'
+ and ou.OU_subsidiary_prefix is not null
+ )
+ select 1 as Position, [Company], null as [Code], '' as [Code_name]
+ from [Pharmacy]
+ union
+ select 2 as Position, [Company], [Code], [Code_name]
+ from Pharmacy
+ order by Position, Company, Code
+
+
+ with CostCenter([Code], [Company])
+ as
+ (SELECT pcck.PCCK_key AS [Code],
+ coalesce(asub.Code, ou.OU_subsidiary_prefix) AS [Company]
+ from crs.vwOrganizationalUnit ou with (nolock)
+ left join crs.AdditionalSubsidiaryLink asl with (nolock)
+ on ou.Reference_Organizational_unit_ID = asl.OrganizationalUnitId
+ left join crs.AdditionalSubsidiary asub with (nolock)
+ on asl.AdditionalSubsidiaryId = asub.AdditionalSubsidiaryId
+ inner join phar.Profit_cost_center_key pcck with (nolock)
+ on pcck.PCCK_profit_cost_center = ou.OU_profit_cost_center
+ and pcck.PCCK_pharmacy_code = ou.OU_pharmacy_code
+ inner join phar.Fiscal_year fy with (nolock)
+ on fy.Fiscal_year_ID = pcck.PCCK_fiscal_year
+ and fy.FY_pharmacy_code = pcck.PCCK_pharmacy_code
+ and fy.FY_subsidiary = ou.OU_subsidiary
+ and fy.FY_number = 2022
+ and pcck.PCCK_type = Case When coalesce(asub.Code, ou.OU_subsidiary_prefix) in ('CVI', 'SUN') Then 3
+ Else 1 End
+ where ou.OU_centrale_code = 'G')
+ SELECT 1 as Position, null as [Code], '' as [Code_name], null as [Company] from CostCenter
+ union
+ SELECT 2 as Position, null as [Code], '' as [Code_name], [Company] from CostCenter
+ union
+ SELECT 3 as Position, [Code], [Code] as [Code_name], [Company] from CostCenter
+ order by Position, Company, Code
+ ---------------------------
+
+ LifeStageInvoices
+ l'ouverture rdu rapport lance 2 query. la 1ere liste les "cost centeers" comme dans le rapport précédent
+ Démarre la query suivante en environ 38 secondes:
+ ----------------
+ exec sp_executesql N'SELECT dh.DH_doc_number AS InvoiceNumber,
+ dh.DH_value_date AS InvoiceDate,
+ et.ET_debit_base_amount AS InvoiceAmount,
+ dh.DH_sold_to_text AS CustomerName,
+ coalesce(et.ET_debit_base_amount, 0) - coalesce(SUM(etr.ETR_base_amount), 0) AS DueAmount,
+ dh.DH_invoice_group AS LifeStageNumber,
+ ins.PHIN_name_german AS [Debtor]
+ FROM [Gaia].[phar].[Document_header] dh WITH (nolock)
+ INNER JOIN phar.Entry et WITH (nolock)
+ ON dh.document_header_id = et.ET_document_header
+ AND dh.dh_account = et.Et_account
+ AND dh.DH_pharmacy_code = et.ET_pharmacy_code
+ LEFT JOIN phar.Entry_reconciliation etr WITH (nolock)
+ ON et.Entry_ID = etr.ETR_entry
+ AND et.ET_pharmacy_code = etr.ETR_pharmacy_code
+ left join phar.PH_insurance as ins with (nolock)
+ on ins.PHIN_address = dh.DH_send_bill_to
+ and left(ins.PHIN_pharmacy_code, 1) = left(dh.DH_pharmacy_code, 1)
+ WHERE dh.DH_invoice_group IS NOT NULL
+ AND dh.DH_our_ref LIKE ''LifeStage%''
+ AND dh.DH_pharmacy_code = @PharmacyLifeStage
+ GROUP BY dh.DH_doc_number,
+ dh.Document_header_ID,
+ dh.DH_value_date,
+ et.ET_debit_base_amount,
+ dh.DH_sold_to_text,
+ dh.DH_BVR_reference,
+ dh.DH_account,
+ dh.DH_invoice_group,
+ dh.DH_our_ref,
+ et.ET_reconciliation_status,
+ ins.PHIN_name_german
+ HAVING ((@LifeStageInvoiceNumber is not null AND dh.DH_invoice_group like @LifeStageInvoiceNumber + ''%'')
+ OR (@TriaPharmInvoiceNumber is not null AND @LifeStageInvoiceNumber is null AND dh.DH_Doc_number like @TriaPharmInvoiceNumber + ''%'')
+ OR (@LifeStageInvoiceNumber is null AND @TriaPharmInvoiceNumber is null AND dh.DH_value_date between @InvoiceDateFrom AND isnull(@InvoiceDateTo, cast(getDate() as date))
+ AND (@OpenedInvoice = 0 OR isnull(et.ET_reconciliation_status, 1) = 1)));',N'@InvoiceDateFrom datetime,@InvoiceDateTo nvarchar(4000),@LifeStageInvoiceNumber nvarchar(4000),@OpenedInvoice bit,@TriaPharmInvoiceNumber nvarchar(4000),@PharmacyLifeStage nvarchar(6)',@InvoiceDateFrom='2022-01-01 00:00:00',@InvoiceDateTo=NULL,@LifeStageInvoiceNumber=NULL,@OpenedInvoice=1,@TriaPharmInvoiceNumber=NULL,@PharmacyLifeStage=N'GAM316'
+ ----------------
+
+ OpenInvoiceDetails:
+ nécessite un "master id", l'entrée de data bidon remonte la query suivante lancée:
+ -------------------
+ (@InvoiceDateFrom datetime,@InvoiceDateTo nvarchar(4000),@LifeStageInvoiceNumber nvarchar(4000),@OpenedInvoice bit,@TriaPharmInvoiceNumber nvarchar(4000),@PharmacyLifeStage nvarchar(6))SELECT dh.DH_doc_number AS InvoiceNumber,
+ dh.DH_value_date AS InvoiceDate,
+ et.ET_debit_base_amount AS InvoiceAmount,
+ dh.DH_sold_to_text AS CustomerName,
+ coalesce(et.ET_debit_base_amount, 0) - coalesce(SUM(etr.ETR_base_amount), 0) AS DueAmount,
+ dh.DH_invoice_group AS LifeStageNumber,
+ ins.PHIN_name_german AS [Debtor]
+ FROM [Gaia].[phar].[Document_header] dh WITH (nolock)
+ INNER JOIN phar.Entry et WITH (nolock)
+ ON dh.document_header_id = et.ET_document_header
+ AND dh.dh_account = et.Et_account
+ AND dh.DH_pharmacy_code = et.ET_pharmacy_code
+ LEFT JOIN phar.Entry_reconciliation etr WITH (nolock)
+ ON et.Entry_ID = etr.ETR_entry
+ AND et.ET_pharmacy_code = etr.ETR_pharmacy_code
+ left join phar.PH_insurance as ins with (nolock)
+ on ins.PHIN_address = dh.DH_send_bill_to
+ and left(ins.PHIN_pharmacy_code, 1) = left(dh.DH_pharmacy_code, 1)
+ WHERE dh.DH_invoice_group IS NOT NULL
+ AND dh.DH_our_ref LIKE 'LifeStage%'
+ AND dh.DH_pharmacy_code = @PharmacyLifeStage
+ GROUP BY dh.DH_doc_number,
+ dh.Document_header_ID,
+ dh.DH_value_date,
+ et.ET_debit_base_amount,
+ dh.DH_sold_to_text,
+ dh.DH_BVR_reference,
+ dh.DH_account,
+ dh.DH_invoice_group,
+ dh.DH_our_ref,
+ et.ET_reconciliation_status,
+ ins.PHIN_name_german
+ HAVING ((@LifeStageInvoiceNumber is not null AND dh.DH_invoice_group like @LifeStageInvoiceNumber + '%')
+ OR (@TriaPharmInvoiceNumber is not null AND @LifeStageInvoiceNumber is null AND dh.DH_Doc_number like @TriaPharmInvoiceNumber + '%')
+ OR (@LifeStageInvoiceNumber is null AND @TriaPharmInvoiceNumber is null AND dh.DH_value_date between @InvoiceDateFrom AND isnull(@InvoiceDateTo, cast(getDate() as date))
+ AND (@OpenedInvoice = 0 OR isnull(et.ET_reconciliation_status, 1) = 1)));
+ -------------------
+
+ OpenInvoice:
+ lance une query en entrant sur le rapport pour lister les formats et les OU.
+ -----------------
+ select ou.Organizational_unit_ID [Reference_Organizational_unit_ID],
+ case when charindex(ou.OU_code,ou.OU_short_name) > 0 then ou.OU_short_name else ou.OU_short_name + ' ' + ou.OU_code end [Name]
+ from phar.Organizational_unit as ou
+ join [crs].[vwSubsidiary] as sub
+ on sub.Reference_Subsidiary_ID = ou.OU_subsidiary
+ join phar.PH_organizational_unit as phou
+ on phou.PHOU_organizational_unit = ou.Organizational_unit_ID
+ and phou.PHOU_pharmacy_code = ou.OU_pharmacy_code
+ left join phar.Organizational_unit ou2
+ on ou2.OU_master_ID = ou.Organizational_unit_ID and ou2.OU_pharmacy_code = 'A00000'
+ where ou.OU_pharmacy_code = 'G00000'
+ and ou.OU_subsidiary = 1
+ order by ou.OU_subsidiary, ou.OU_short_name
+
+ select sub.Reference_Subsidiary_ID,
+ sub.SUB_prefix
+ from crs.vwSubsidiary sub with (nolock)
+ -----------------
+
+ Le lancement du report lance la proc reportOpenInvoice qui mouline bien sur Gaia
+ -----------------
+ exec crs.ReportOpenInvoices @Format=N'1',@Pharmacy=N'185;157;249;339;366;205;142;308;186;354;285;296;148;298;341;284;322;290;169;144;349;173;163;133;348;342;146;261;124;174;248;137;260;202;117;156;194;254;207;287;334;247;227;153;552;345;663;306;128;130;129;327;131;844;843;300;189;295;338;333;217;110;161;198;329;111;109;270;210;330;103;343;854;224;340;336;272;145;328;166;346;136;859;122;134;135;125;314;118;307;123;760;292;164;120;301;291;195;282;721;571;132;317;114;113;112;115;119;305;302;570;319;544;140;323;373;320;138;139;303;344;318;147;274;310;358;357;359;574;575;873;321;311;175;360;388;331;216;560;143;126;559;299;121;781;335;304',@InvoiceNumber=NULL,@NegativeAmount=0
+ -----------------
+
+*/
\ No newline at end of file
diff --git a/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/pharmacies.sql b/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/pharmacies.sql
new file mode 100644
index 0000000..513ff62
--- /dev/null
+++ b/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/pharmacies.sql
@@ -0,0 +1,70 @@
+/*=============================================================================
+
+OCTPDBA-565
+Manage indexes followig 23.2 release branch
+
+Parameters
+----------------------
+
+
+Context
+----------------------
+Every pharmacies
+
+Creation : 21.04.2023 / TSC
+Modifications:
+
+=============================================================================*/
+USE [Arizona]
+GO
+
+/*
+Item_criteria
+drop old constraints. 2 can be merged and 1 is not used
+
+XIEAPS2Item_criteria = dbo.Item_criteria(ITCR_master_ID) ==> to drop, not used
+XIF1039Item_criteria = dbo.Item_criteria(ITCR_item) ==> becomes an include on the index on ITCR_criteria
+XIF1041Item_criteria = dbo.Item_criteria(ITCR_criteria)
+*/
+IF INDEXPROPERTY(OBJECT_ID('dbo.Item_criteria'), 'XIEAPS2Item_criteria' , 'IndexID' ) IS NOT NULL BEGIN;
+ DROP INDEX dbo.Item_criteria.XIEAPS2Item_criteria;
+END;
+GO
+
+IF INDEXPROPERTY(OBJECT_ID('dbo.Item_criteria'), 'XIF1039Item_criteria' , 'IndexID' ) IS NOT NULL BEGIN;
+ DROP INDEX dbo.Item_criteria.XIF1039Item_criteria;
+END;
+GO
+
+IF INDEXPROPERTY(OBJECT_ID('dbo.Item_criteria'), 'XIF1041Item_criteria' , 'IndexID' ) IS NOT NULL BEGIN;
+ DROP INDEX dbo.Item_criteria.XIF1041Item_criteria;
+END;
+GO
+
+
+IF INDEXPROPERTY(OBJECT_ID('dbo.Item_criteria'), 'NCIX_Item_criteria_COL_ITCR_criteria' , 'IndexID' ) IS NULL BEGIN;
+ CREATE NONCLUSTERED INDEX NCIX_Item_criteria_COL_ITCR_criteria ON dbo.Item_criteria(ITCR_criteria)
+ INCLUDE(ITCR_item);
+END;
+GO
+
+
+/* ------------------------------------------------------ */
+
+/*
+Document_line
+
+the index NCIX_Document_line_COL_DL_type is not used.
+Adapt it to follow the recommendation
+*/
+
+-- NCIX_Document_line_COL_DL_type
+IF INDEXPROPERTY(OBJECT_ID('dbo.Document_line'), 'NCIX_Document_line_COL_DL_type' , 'IndexID' ) IS NOT NULL BEGIN;
+ DROP INDEX [dbo].[Document_line].[NCIX_Document_line_COL_DL_type];
+END;
+GO
+IF INDEXPROPERTY(OBJECT_ID('dbo.Document_line'), 'NCIX_Document_line_COL_DL_type' , 'IndexID' ) IS NULL BEGIN;
+ CREATE INDEX [NCIX_Document_line_COL_DL_type] ON [dbo].[Document_line]([DL_type], [DL_to_be_invoiced])
+ INCLUDE([DL_document_header]);
+END;
+GO
diff --git a/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/revert central.sql b/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/revert central.sql
new file mode 100644
index 0000000..0c0eaff
--- /dev/null
+++ b/OCTPDBA-565 manage index 23.2/OCTPDBA-565 manage index 23.2/revert central.sql
@@ -0,0 +1,89 @@
+/*=============================================================================
+
+What does it does ?
+
+Parameters
+----------------------
+
+
+Context
+----------------------
+What is the context, where does it needs to run ?
+
+Creation : 25.04.2023 / TSC
+Modifications:
+
+=============================================================================*/
+SET XACT_ABORT ON;
+SET NOCOUNT ON;
+
+USE [Arizona]
+
+-- XIF1039Item_criteria
+IF INDEXPROPERTY(OBJECT_ID('arizona.dbo.Item_criteria'), 'XIF1039Item_criteria' , 'IndexID' ) IS NULL BEGIN;
+ CREATE INDEX XIF1039Item_criteria ON arizona.dbo.Item_criteria(ITCR_item);
+END;
+GO
+
+
+-- XIF1041Item_criteria
+IF INDEXPROPERTY(OBJECT_ID('arizona.dbo.Item_criteria'), 'XIF1041Item_criteria' , 'IndexID' ) IS NULL BEGIN;
+ CREATE INDEX XIF1041Item_criteria ON arizona.dbo.Item_criteria(ITCR_criteria);
+END;
+GO
+
+IF INDEXPROPERTY(OBJECT_ID('arizona.dbo.Item_criteria'), 'NCIX_Item_criteria_COL_ITCR_item' , 'IndexID' ) IS NOT NULL BEGIN
+ DROP INDEX dbo.Item_criteria.NCIX_Item_criteria_COL_ITCR_item
+END
+
+IF INDEXPROPERTY(OBJECT_ID('arizona.dbo.document_line'), 'NCIX_Document_line_COL_DL_to_be_invoiced' , 'IndexID' ) IS NOT NULL BEGIN
+ DROP INDEX dbo.[Document_line].NCIX_Document_line_COL_DL_to_be_invoiced
+END
+
+
+
+/* Fixed_price. */
+IF INDEXPROPERTY(OBJECT_ID('arizona.dbo.Fixed_price'), 'NCIX_Fixed_price_COL_FP_tariff_type' , 'IndexID' ) IS NOT NULL BEGIN
+ DROP INDEX [dbo].[Fixed_price].[NCIX_Fixed_price_COL_FP_tariff_type]
+END
+
+IF INDEXPROPERTY(OBJECT_ID('arizona.dbo.Fixed_price'), 'NCIX_Fixed_price_COL_FP_tariff_type_FP_start_date' , 'IndexID' ) IS NOT NULL BEGIN
+ DROP INDEX dbo.Fixed_price.[NCIX_Fixed_price_COL_FP_tariff_type_FP_start_date]
+END
+
+IF INDEXPROPERTY(OBJECT_ID('arizona.dbo.Fixed_price'), 'NCIX_Fixed_price_COL_FP_price_code' , 'IndexID' ) IS NOT NULL BEGIN
+ DROP INDEX dbo.Fixed_price.[NCIX_Fixed_price_COL_FP_price_code]
+END
+
+IF INDEXPROPERTY(OBJECT_ID('arizona.dbo.Fixed_price'), 'NCIX_Fixed_price_COL_FP_subsidiary' , 'IndexID' ) IS NOT NULL BEGIN
+ DROP INDEX dbo.Fixed_price.[NCIX_Fixed_price_COL_FP_subsidiary]
+END
+
+
+/* item_key */
+IF INDEXPROPERTY(OBJECT_ID('arizona.dbo.Item_key'), 'NCIX_Item_key_COL_ITK_subsidiary' , 'IndexID' ) IS NOT NULL BEGIN
+ DROP INDEX dbo.Item_key.[NCIX_Item_key_COL_ITK_subsidiary]
+END
+
+/*Item_statistics_yearly. heap table with no indexes*/
+IF INDEXPROPERTY(OBJECT_ID('arizona.dbo.Item_statistics_yearly'), 'NCIX_Item_statistics_yearly_COL_ITSTAY_item' , 'IndexID' ) IS NOT NULL BEGIN
+ DROP INDEX dbo.Item_statistics_yearly.[NCIX_Item_statistics_yearly_COL_ITSTAY_item]
+END
+
+IF INDEXPROPERTY(OBJECT_ID('arizona.dbo.Item_statistics_yearly'), 'NCIX_Item_statistics_yearly_COL_ITSTAY_year' , 'IndexID' ) IS NOT NULL BEGIN
+ DROP INDEX dbo.Item_statistics_yearly.[NCIX_Item_statistics_yearly_COL_ITSTAY_year]
+END
+
+
+/*Item_status_history.*/
+IF INDEXPROPERTY(OBJECT_ID('arizona.dbo.Item_status_history'), 'NCIX_Item_status_history_COL_ITSH_value_date' , 'IndexID' ) IS NOT NULL BEGIN
+ DROP INDEX dbo.Item_status_history.[NCIX_Item_status_history_COL_ITSH_value_date]
+END
+
+/* ------------------------------------------------------ */
+
+USE [PharmIndexTP]
+IF INDEXPROPERTY(OBJECT_ID('PharmIndexTP.dbo.mapping_PHGD_CompendiumText'), 'NCIX_mapping_PHGD_CompendiumText_COL_PHGD_CPDTXT_GUID' , 'IndexID' ) IS NULL BEGIN
+ DROP INDEX dbo.mapping_PHGD_CompendiumText.[NCIX_mapping_PHGD_CompendiumText_COL_PHGD_CPDTXT_GUID]
+ END
+
diff --git a/xe_host_app_query.viewsetting b/xe_host_app_query.viewsetting
new file mode 100644
index 0000000..254d7ae
--- /dev/null
+++ b/xe_host_app_query.viewsetting
@@ -0,0 +1,21 @@
+
+
+
+
+ 160
+
+
+
+ 160
+
+
+
+ 100
+
+
+
+ 100
+
+
+
+
\ No newline at end of file