IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_DIAGNOSIS]') AND name = N'UQ_T_CDA_SECTION_DIAGNOSIS_CdaDocumentProtocolextractRev2' and is_unique_constraint <> 1)
DROP INDEX [UQ_T_CDA_SECTION_DIAGNOSIS_CdaDocumentProtocolextractRev2] ON [AKUZ].[T_CDA_SECTION_DIAGNOSIS]
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_DIAGNOSIS]') AND name = N'UQ_T_CDA_SECTION_DIAGNOSIS_CdaDocumentProtocolextractRev2' and is_unique_constraint = 1)
ALTER TABLE [AKUZ].[T_CDA_SECTION_DIAGNOSIS] DROP CONSTRAINT [UQ_T_CDA_SECTION_DIAGNOSIS_CdaDocumentProtocolextractRev2]
IF  EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_DIAGNOSIS]') AND name = N'CdaDocumentProtocolextractRev2_UQ')
ALTER TABLE [AKUZ].[T_CDA_SECTION_DIAGNOSIS] DROP COLUMN [CdaDocumentProtocolextractRev2_UQ]
GO

exec dbo.sp_AlterDropColumn '[AKUZ].[T_CDA_SECTION_DIAGNOSIS]' , 'CdaDocumentProtocolextractRev2', 1, 'uniqueidentifier NULL'
GO

ALTER TABLE [AKUZ].[T_CDA_SECTION_DIAGNOSIS]ADD [CdaDocumentProtocolextractRev2_UQ] AS (CASE WHEN [CdaDocumentProtocolextractRev2] IS NOT NULL THEN NULL ELSE [CdaSectionDiagnosisID] END)
GO
CREATE UNIQUE NONCLUSTERED INDEX [UQ_T_CDA_SECTION_DIAGNOSIS_CdaDocumentProtocolextractRev2] ON [AKUZ].[T_CDA_SECTION_DIAGNOSIS] ([CdaDocumentProtocolextractRev2] ASC, [CdaDocumentProtocolextractRev2_UQ] ASC) ON [PRIMARY]
GO
--
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_DOCINFO_PROTOCOLV2]') AND name = N'UQ_T_CDA_SECTION_DOCINFO_PROTOCOLV2_CdaDocumentProtocolextractRev2' and is_unique_constraint <> 1)
DROP INDEX [UQ_T_CDA_SECTION_DOCINFO_PROTOCOLV2_CdaDocumentProtocolextractRev2] ON [AKUZ].[T_CDA_SECTION_DOCINFO_PROTOCOLV2]
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_DOCINFO_PROTOCOLV2]') AND name = N'UQ_T_CDA_SECTION_DOCINFO_PROTOCOLV2_CdaDocumentProtocolextractRev2' and is_unique_constraint = 1)
ALTER TABLE [AKUZ].[T_CDA_SECTION_DOCINFO_PROTOCOLV2] DROP CONSTRAINT [UQ_T_CDA_SECTION_DOCINFO_PROTOCOLV2_CdaDocumentProtocolextractRev2]
IF  EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_DOCINFO_PROTOCOLV2]') AND name = N'CdaDocumentProtocolextractRev2_UQ')
ALTER TABLE [AKUZ].[T_CDA_SECTION_DOCINFO_PROTOCOLV2] DROP COLUMN [CdaDocumentProtocolextractRev2_UQ]
GO

exec dbo.sp_AlterDropColumn '[AKUZ].[T_CDA_SECTION_DOCINFO_PROTOCOLV2]' , 'CdaDocumentProtocolextractRev2', 1, 'uniqueidentifier NULL'
GO

ALTER TABLE [AKUZ].[T_CDA_SECTION_DOCINFO_PROTOCOLV2]ADD [CdaDocumentProtocolextractRev2_UQ] AS (CASE WHEN [CdaDocumentProtocolextractRev2] IS NOT NULL THEN NULL ELSE [CdaSectionDocinfoProtocolv2ID] END)
GO
CREATE UNIQUE NONCLUSTERED INDEX [UQ_T_CDA_SECTION_DOCINFO_PROTOCOLV2_CdaDocumentProtocolextractRev2] ON [AKUZ].[T_CDA_SECTION_DOCINFO_PROTOCOLV2] ([CdaDocumentProtocolextractRev2] ASC, [CdaDocumentProtocolextractRev2_UQ] ASC) ON [PRIMARY]
GO
--
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_HIGHTECH_CARE]') AND name = N'UQ_T_CDA_SECTION_HIGHTECH_CARE_CdaDocumentProtocolextractRev2' and is_unique_constraint <> 1)
DROP INDEX [UQ_T_CDA_SECTION_HIGHTECH_CARE_CdaDocumentProtocolextractRev2] ON [AKUZ].[T_CDA_SECTION_HIGHTECH_CARE]
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_HIGHTECH_CARE]') AND name = N'UQ_T_CDA_SECTION_HIGHTECH_CARE_CdaDocumentProtocolextractRev2' and is_unique_constraint = 1)
ALTER TABLE [AKUZ].[T_CDA_SECTION_HIGHTECH_CARE] DROP CONSTRAINT [UQ_T_CDA_SECTION_HIGHTECH_CARE_CdaDocumentProtocolextractRev2]
IF  EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_HIGHTECH_CARE]') AND name = N'CdaDocumentProtocolextractRev2_UQ')
ALTER TABLE [AKUZ].[T_CDA_SECTION_HIGHTECH_CARE] DROP COLUMN [CdaDocumentProtocolextractRev2_UQ]
GO

exec dbo.sp_AlterDropColumn '[AKUZ].[T_CDA_SECTION_HIGHTECH_CARE]' , 'CdaDocumentProtocolextractRev2', 1, 'uniqueidentifier NULL'
GO

ALTER TABLE [AKUZ].[T_CDA_SECTION_HIGHTECH_CARE]ADD [CdaDocumentProtocolextractRev2_UQ] AS (CASE WHEN [CdaDocumentProtocolextractRev2] IS NOT NULL THEN NULL ELSE [CdaSectionHightechCareID] END)
GO
CREATE UNIQUE NONCLUSTERED INDEX [UQ_T_CDA_SECTION_HIGHTECH_CARE_CdaDocumentProtocolextractRev2] ON [AKUZ].[T_CDA_SECTION_HIGHTECH_CARE] ([CdaDocumentProtocolextractRev2] ASC, [CdaDocumentProtocolextractRev2_UQ] ASC) ON [PRIMARY]
GO
--
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_LINKED_DOCS]') AND name = N'UQ_T_CDA_SECTION_LINKED_DOCS_CdaDocumentProtocolextractRev2' and is_unique_constraint <> 1)
DROP INDEX [UQ_T_CDA_SECTION_LINKED_DOCS_CdaDocumentProtocolextractRev2] ON [AKUZ].[T_CDA_SECTION_LINKED_DOCS]
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_LINKED_DOCS]') AND name = N'UQ_T_CDA_SECTION_LINKED_DOCS_CdaDocumentProtocolextractRev2' and is_unique_constraint = 1)
ALTER TABLE [AKUZ].[T_CDA_SECTION_LINKED_DOCS] DROP CONSTRAINT [UQ_T_CDA_SECTION_LINKED_DOCS_CdaDocumentProtocolextractRev2]
IF  EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_LINKED_DOCS]') AND name = N'CdaDocumentProtocolextractRev2_UQ')
ALTER TABLE [AKUZ].[T_CDA_SECTION_LINKED_DOCS] DROP COLUMN [CdaDocumentProtocolextractRev2_UQ]
GO

exec dbo.sp_AlterDropColumn '[AKUZ].[T_CDA_SECTION_LINKED_DOCS]' , 'CdaDocumentProtocolextractRev2', 1, 'uniqueidentifier NULL'
GO

ALTER TABLE [AKUZ].[T_CDA_SECTION_LINKED_DOCS]ADD [CdaDocumentProtocolextractRev2_UQ] AS (CASE WHEN [CdaDocumentProtocolextractRev2] IS NOT NULL THEN NULL ELSE [CdaSectionLinkedDocsID] END)
GO
CREATE UNIQUE NONCLUSTERED INDEX [UQ_T_CDA_SECTION_LINKED_DOCS_CdaDocumentProtocolextractRev2] ON [AKUZ].[T_CDA_SECTION_LINKED_DOCS] ([CdaDocumentProtocolextractRev2] ASC, [CdaDocumentProtocolextractRev2_UQ] ASC) ON [PRIMARY]
GO
--
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_SERVICES_PROVIDED]') AND name = N'UQ_T_CDA_SECTION_SERVICES_PROVIDED_CdaDocumentProtocolextractRev2' and is_unique_constraint <> 1)
DROP INDEX [UQ_T_CDA_SECTION_SERVICES_PROVIDED_CdaDocumentProtocolextractRev2] ON [AKUZ].[T_CDA_SECTION_SERVICES_PROVIDED]
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_SERVICES_PROVIDED]') AND name = N'UQ_T_CDA_SECTION_SERVICES_PROVIDED_CdaDocumentProtocolextractRev2' and is_unique_constraint = 1)
ALTER TABLE [AKUZ].[T_CDA_SECTION_SERVICES_PROVIDED] DROP CONSTRAINT [UQ_T_CDA_SECTION_SERVICES_PROVIDED_CdaDocumentProtocolextractRev2]
IF  EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_SERVICES_PROVIDED]') AND name = N'CdaDocumentProtocolextractRev2_UQ')
ALTER TABLE [AKUZ].[T_CDA_SECTION_SERVICES_PROVIDED] DROP COLUMN [CdaDocumentProtocolextractRev2_UQ]
GO

exec dbo.sp_AlterDropColumn '[AKUZ].[T_CDA_SECTION_SERVICES_PROVIDED]' , 'CdaDocumentProtocolextractRev2', 1, 'uniqueidentifier NULL'
GO

ALTER TABLE [AKUZ].[T_CDA_SECTION_SERVICES_PROVIDED]ADD [CdaDocumentProtocolextractRev2_UQ] AS (CASE WHEN [CdaDocumentProtocolextractRev2] IS NOT NULL THEN NULL ELSE [CdaSectionServicesProvidedID] END)
GO
CREATE UNIQUE NONCLUSTERED INDEX [UQ_T_CDA_SECTION_SERVICES_PROVIDED_CdaDocumentProtocolextractRev2] ON [AKUZ].[T_CDA_SECTION_SERVICES_PROVIDED] ([CdaDocumentProtocolextractRev2] ASC, [CdaDocumentProtocolextractRev2_UQ] ASC) ON [PRIMARY]
GO
--
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_SPECIALIZED_CARE]') AND name = N'UQ_T_CDA_SECTION_SPECIALIZED_CARE_CdaDocumentProtocolextractRev2' and is_unique_constraint <> 1)
DROP INDEX [UQ_T_CDA_SECTION_SPECIALIZED_CARE_CdaDocumentProtocolextractRev2] ON [AKUZ].[T_CDA_SECTION_SPECIALIZED_CARE]
IF  EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_SPECIALIZED_CARE]') AND name = N'UQ_T_CDA_SECTION_SPECIALIZED_CARE_CdaDocumentProtocolextractRev2' and is_unique_constraint = 1)
ALTER TABLE [AKUZ].[T_CDA_SECTION_SPECIALIZED_CARE] DROP CONSTRAINT [UQ_T_CDA_SECTION_SPECIALIZED_CARE_CdaDocumentProtocolextractRev2]
IF  EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[AKUZ].[T_CDA_SECTION_SPECIALIZED_CARE]') AND name = N'CdaDocumentProtocolextractRev2_UQ')
ALTER TABLE [AKUZ].[T_CDA_SECTION_SPECIALIZED_CARE] DROP COLUMN [CdaDocumentProtocolextractRev2_UQ]
GO

exec dbo.sp_AlterDropColumn '[AKUZ].[T_CDA_SECTION_SPECIALIZED_CARE]' , 'CdaDocumentProtocolextractRev2', 1, 'uniqueidentifier NULL'
GO

ALTER TABLE [AKUZ].[T_CDA_SECTION_SPECIALIZED_CARE]ADD [CdaDocumentProtocolextractRev2_UQ] AS (CASE WHEN [CdaDocumentProtocolextractRev2] IS NOT NULL THEN NULL ELSE [CdaSectionSpecializedCareID] END)
GO
CREATE UNIQUE NONCLUSTERED INDEX [UQ_T_CDA_SECTION_SPECIALIZED_CARE_CdaDocumentProtocolextractRev2] ON [AKUZ].[T_CDA_SECTION_SPECIALIZED_CARE] ([CdaDocumentProtocolextractRev2] ASC, [CdaDocumentProtocolextractRev2_UQ] ASC) ON [PRIMARY]
GO

