Once tabloyu oluturalım USE [GURMEN] GO /****** Object: Table [dbr].[DBA_CDClog] Script Date: 14.11.2016 17:25:14 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbr].[DBA_CDClog] ( [DBA_CDClogID] [bigint] IDENTITY(1, 1) NOT NULL, [SeqValue] [BINARY](10) NOT NULL, [SchemaName] [nvarchar](50) NOT NULL, [TableName] [nvarchar](100) NOT NULL, [RowGuid] [uniqueidentifier] NOT NULL, [PKeyColumnName] [nvarchar](100) NOT NULL, [PKeyNewValue] [nvarchar](150) NULL, [PKeyOldValue] [nvarchar](150) NULL, [Operation] [char](1) NOT NULL, [Status] [char](1) NOT NULL, [LastUpdatedUserName] [nvarchar](100) NOT NULL, [CdcLogDate] [datetime] NOT NULL, [CDCInsertedDate] [datetime] NULL, [NebimLastUpdatedDate] [datetime] NULL, [NebimCreatedDate] [datetime] NULL, [IsLateInsertedRecord] [bit] NULL, CONSTRAINT [PK_DBA_CDClog] PRIMARY KEY CLUSTERED ( [DBA_CDClogID] ASC ) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [CDCTBLOGFG], CONSTRAINT [UNQ_SeqValue] UNIQUE NONCLUSTERED ( [SeqValue] ASC ) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [NONCLUSTEREDIDXFG] ) ON [CDCTBLOGFG] GO ALTER TABLE [dbr].[DBA_CDClog] ADD CONSTRAINT [DF_DBA_CDClog_Status] DEFAULT ('P') FOR [Status] GO ALTER TABLE [dbr].[DBA_CDClog] ADD CONSTRAINT [DF_DBA_CDClog_CdcLogDate] DEFAULT (getdate()) FOR [CdcLogDate] GO ALTER TABLE [dbr].[DBA_CDClog] ADD CONSTRAINT [DF_IsLate] DEFAULT ((0)) FOR [IsLateInsertedRecord] GO --- Sonra procedure yazalım USE [GURMEN] GO /****** Object: StoredProcedure [dbr].[dba_Replicator_Static] Script Date: 21.11.2016 13:30:44 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbr].[dba_Replicator_Static] AS BEGIN BEGIN TRY -- 1 cdCurrAcc Tablosu INSERT INTO [dbr].[DBA_CDClog] (SeqValue, SchemaName, TableName, RowGuid,PKeyColumnName,PkeyNewValue,PkeyOldValue, Operation, LastUpdatedUserName, NebimCreatedDate, NebimLastUpdatedDate, CDCInsertedDate ) SELECT C.[__$seqval] AS SeqValue ,'dbo' AS SchameName ,'cdCurrAcc' AS TableName ,RowGuid AS RowGuid ,'CurrAccTypeCode||CurrAccCode' AS PKeyColumnName ,CASE C.[__$operation] WHEN 1 THEN CAST(CurrAccTypeCode as nvarchar(2))+'||'+ltrim(rtrim(CurrAccCode)) WHEN 2 THEN CAST(CurrAccTypeCode as nvarchar(2))+'||'+ltrim(rtrim(CurrAccCode)) WHEN 4 THEN '' END AS PkeyNewValue ,CASE C.[__$operation] WHEN 1 THEN '' WHEN 2 THEN '' WHEN 4 THEN CAST(CurrAccTypeCode as nvarchar(2))+'||'+ltrim(rtrim(CurrAccCode)) END AS PkeyOldValue ,CASE C.[__$operation] WHEN 1 THEN 'D' WHEN 2 THEN 'I' WHEN 4 THEN 'U' END AS Operation ,C.[LastUpdatedUserName] ,C.[CreatedDate] AS NebimCreatedDate ,C.[LastUpdatedDate] AS NebimLastUpdatedDate ,C.[CDCInsertedDate] AS CDCTableInsertedDate FROM [cdc].[dbo_cdCurrAcc_CT] C WITH(NOLOCK) INNER JOIN [cdc].[lsn_time_mapping] T WITH(NOLOCK) ON C.[__$start_lsn]=T.[start_lsn] WHERE C.[__$seqval] > ( SELECT MAX(SeqValue) FROM dbr.DBA_CDClog WHERE TableName = 'cdCurrAcc' ) AND C.[__$operation] IN (1,2,4) AND C.[LastUpdatedUserName] NOT IN ('uates','adminREPADMIN','admine','REPKETM','REPRETM') AND T.[tran_end_time] < DateAdd(minute, -1, getDate()) UNION ALL -- 2 prCurrAccAttribute tablosu SELECT C.[__$seqval] AS SeqValue ,'dbo' AS SchameName ,'prCurrAccAttribute' AS TableName ,RowGuid AS RowGuid ,'CurrAccTypeCode||CurrAccCode||AttributeTypeCode' AS PKeyColumnName ,CASE C.[__$operation] WHEN 1 THEN CAST(CurrAccTypeCode as nvarchar(2))+'||'+ltrim(rtrim(CurrAccCode))+'||'+CAST(AttributeTypeCode as nvarchar(2)) WHEN 2 THEN CAST(CurrAccTypeCode as nvarchar(2))+'||'+ltrim(rtrim(CurrAccCode))+'||'+CAST(AttributeTypeCode as nchar(2)) WHEN 4 THEN '' END AS PkeyNewValue ,CASE C.[__$operation] WHEN 1 THEN '' WHEN 2 THEN '' WHEN 4 THEN CAST(CurrAccTypeCode as nvarchar(2))+'||'+ltrim(rtrim(CurrAccCode))+'||'+CAST(AttributeTypeCode as nvarchar(2)) END AS PkeyOldValue ,CASE C.[__$operation] WHEN 1 THEN 'D' WHEN 2 THEN 'I' WHEN 4 THEN 'U' END AS Operation ,C.[LastUpdatedUserName] ,C.[CreatedDate] AS NebimCreatedDate ,C.[LastUpdatedDate] AS NebimLastUpdatedDate ,C.[CDCInsertedDate] AS CDCTableInsertedDate FROM [cdc].[dbo_prCurrAccAttribute_CT] C WITH(NOLOCK) INNER JOIN [cdc].[lsn_time_mapping] T WITH(NOLOCK) ON C.[__$start_lsn]=T.[start_lsn] WHERE C.[__$seqval] > ( SELECT MAX(SeqValue) FROM dbr.DBA_CDClog WITH(NOLOCK) WHERE TableName = 'prCurrAccAttribute' ) AND C.[__$operation] IN (1,2,4) AND C.[LastUpdatedUserName] NOT IN ('uates','adminREPADMIN','admine','REPKETM','REPRETM') AND T.[tran_end_time] < DateAdd(minute, -1, getDate()) UNION ALL -- 3 prCurrAccCommunication SELECT C.[__$seqval] AS SeqValue ,'dbo' AS SchameName ,'prCurrAccCommunication' AS TableName ,CommunicationID AS RowGuid ,'CommunicationID' AS PKeyColumnName ,CASE C.[__$operation] WHEN 1 THEN CAST(CommunicationID as nvarchar(37)) WHEN 2 THEN CAST(CommunicationID as nvarchar(37)) WHEN 4 THEN '' END AS PkeyNewValue ,CASE C.[__$operation] WHEN 1 THEN '' WHEN 2 THEN '' WHEN 4 THEN CAST(CommunicationID as nvarchar(37)) END AS PkeyOldValue ,CASE C.[__$operation] WHEN 1 THEN 'D' WHEN 2 THEN 'I' WHEN 4 THEN 'U' END AS Operation ,C.[LastUpdatedUserName] ,C.[CreatedDate] AS NebimCreatedDate ,C.[LastUpdatedDate] AS NebimLastUpdatedDate ,C.[CDCInsertedDate] AS CDCTableInsertedDate FROM [cdc].[dbo_prCurrAccCommunication_CT] C WITH(NOLOCK) INNER JOIN [cdc].[lsn_time_mapping] T WITH(NOLOCK) ON C.[__$start_lsn]=T.[start_lsn] WHERE C.[__$seqval] > ( SELECT MAX(SeqValue) FROM dbr.DBA_CDClog WHERE TableName = 'prCurrAccCommunication' ) AND C.[__$operation] IN (1,2,4) AND C.[LastUpdatedUserName] NOT IN ('uates','adminREPADMIN','admine','REPKETM','REPRETM') AND T.[tran_end_time] < DateAdd(minute, -1, getDate()) UNION ALL -- 4 prCurrAccPostalAddress SELECT C.[__$seqval] AS SeqValue ,'dbo' AS SchameName ,'prCurrAccPostalAddress' AS TableName ,PostalAddressID AS RowGuid ,'PostalAddressID' AS PKeyColumnName ,CASE C.[__$operation] WHEN 1 THEN CAST(PostalAddressID as nvarchar(37)) WHEN 2 THEN CAST(PostalAddressID as nvarchar(37)) WHEN 4 THEN '' END AS PkeyNewValue ,CASE C.[__$operation] WHEN 1 THEN '' WHEN 2 THEN '' WHEN 4 THEN CAST(PostalAddressID as nvarchar(37)) END AS PkeyOldValue ,CASE C.[__$operation] WHEN 1 THEN 'D' WHEN 2 THEN 'I' WHEN 4 THEN 'U' END AS Operation ,C.[LastUpdatedUserName] ,C.[CreatedDate] AS NebimCreatedDate ,C.[LastUpdatedDate] AS NebimLastUpdatedDate ,C.[CDCInsertedDate] AS CDCTableInsertedDate FROM [cdc].[dbo_prCurrAccPostalAddress_CT] C WITH(NOLOCK) INNER JOIN [cdc].[lsn_time_mapping] T WITH(NOLOCK) ON C.[__$start_lsn]=T.[start_lsn] WHERE C.[__$seqval] > ( SELECT MAX(SeqValue) FROM dbr.DBA_CDClog WHERE TableName = 'prCurrAccPostalAddress' ) AND C.[__$operation] IN (1,2,4) AND C.[LastUpdatedUserName] NOT IN ('uates','adminREPADMIN','admine','REPKETM','REPRETM') AND T.[tran_end_time] < DateAdd(minute, -1, getDate()) UNION ALL -- 5 tpInvoiceDiscountOffer tablosu SELECT C.[__$seqval] AS SeqValue ,'dbo' AS SchameName ,'tpInvoiceDiscountOffer' AS TableName ,InvoiceLineID AS RowGuid ,'InvoiceDiscountOfferID' AS PKeyColumnName ,CASE C.[__$operation] WHEN 1 THEN CAST(InvoiceDiscountOfferID as nvarchar(37)) WHEN 2 THEN CAST(InvoiceDiscountOfferID as nvarchar(37)) WHEN 4 THEN '' END AS PkeyNewValue ,CASE C.[__$operation] WHEN 1 THEN '' WHEN 2 THEN '' WHEN 4 THEN CAST(InvoiceDiscountOfferID as nvarchar(37)) END AS PkeyOldValue ,CASE C.[__$operation] WHEN 1 THEN 'D' WHEN 2 THEN 'I' WHEN 4 THEN 'U' END AS Operation ,C.[LastUpdatedUserName] ,C.[CreatedDate] AS NebimCreatedDate ,C.[LastUpdatedDate] AS NebimLastUpdatedDate ,C.[CDCInsertedDate] AS CDCTableInsertedDate FROM [cdc].[dbo_tpInvoiceDiscountOffer_CT] C WITH(NOLOCK) INNER JOIN [cdc].[lsn_time_mapping] T WITH(NOLOCK) ON C.[__$start_lsn]=T.[start_lsn] WHERE C.[__$seqval] > ( SELECT MAX(SeqValue) FROM dbr.DBA_CDClog WHERE TableName = 'tpInvoiceDiscountOffer' ) AND C.[__$operation] IN (1,2,4) AND C.[LastUpdatedUserName] NOT IN ('uates','adminREPADMIN','admine','REPKETM','REPRETM') AND T.[tran_end_time] < DateAdd(minute, -1, getDate()) UNION ALL -- 6 trBankHeader tablosu SELECT C.[__$seqval] AS SeqValue ,'dbo' AS SchameName ,'trBankHeader' AS TableName ,C.BankHeaderID AS RowGuid ,'BankHeaderID' AS PKeyColumnName ,CASE C.[__$operation] WHEN 1 THEN CAST(BankHeaderID as nvarchar(37)) WHEN 2 THEN CAST(BankHeaderID as nvarchar(37)) WHEN 4 THEN '' END AS PkeyNewValue ,CASE C.[__$operation] WHEN 1 THEN '' WHEN 2 THEN '' WHEN 4 THEN CAST(BankHeaderID as nvarchar(37)) END AS PkeyOldValue ,CASE C.[__$operation] WHEN 1 THEN 'D' WHEN 2 THEN 'I' WHEN 4 THEN 'U' END AS Operation ,C.[LastUpdatedUserName] ,C.[CreatedDate] AS NebimCreatedDate ,C.[LastUpdatedDate] AS NebimLastUpdatedDate ,C.[CDCInsertedDate] AS CDCTableInsertedDate FROM [cdc].[dbo_trBankHeader_CT] C WITH(NOLOCK) INNER JOIN [cdc].[lsn_time_mapping] T WITH(NOLOCK) ON C.[__$start_lsn]=T.[start_lsn] WHERE C.[__$seqval] > ( SELECT MAX(SeqValue) FROM dbr.DBA_CDClog WHERE TableName = 'trBankHeader' ) AND C.[__$operation] IN (1,2,4) AND C.[LastUpdatedUserName] NOT IN ('uates','adminREPADMIN','admine','REPKETM','REPRETM') AND T.[tran_end_time] < DateAdd(minute, -1, getDate()) UNION ALL -- 7 trBankLine tablosu SELECT C.[__$seqval] AS SeqValue ,'dbo' AS SchameName ,'trBankLine' AS TableName ,C.BankLineID AS RowGuid ,'BankLineID' AS PKeyColumnName ,CASE C.[__$operation] WHEN 1 THEN CAST(BankLineID as nvarchar(37)) WHEN 2 THEN CAST(BankLineID as nvarchar(37)) WHEN 4 THEN '' END AS PkeyNewValue ,CASE C.[__$operation] WHEN 1 THEN '' WHEN 2 THEN '' WHEN 4 THEN CAST(BankLineID as nvarchar(37)) END AS PkeyOldValue ,CASE C.[__$operation] WHEN 1 THEN 'D' WHEN 2 THEN 'I' WHEN 4 THEN 'U' END AS Operation ,C.[LastUpdatedUserName] ,C.[CreatedDate] AS NebimCreatedDate ,C.[LastUpdatedDate] AS NebimLastUpdatedDate ,C.[CDCInsertedDate] AS CDCTableInsertedDate FROM [cdc].[dbo_trBankLine_CT] C WITH(NOLOCK) INNER JOIN [cdc].[lsn_time_mapping] T WITH(NOLOCK) ON C.[__$start_lsn]=T.[start_lsn] WHERE C.[__$seqval] > ( SELECT MAX(SeqValue) FROM dbr.DBA_CDClog WHERE TableName = 'trBankLine' ) AND C.[__$operation] IN (1,2,4) AND C.[LastUpdatedUserName] NOT IN ('uates','adminREPADMIN','admine','REPKETM','REPRETM') AND T.[tran_end_time] < DateAdd(minute, -1, getDate()) UNION ALL -- 8 trInvoiceHeader tablosu SELECT C.[__$seqval] AS SeqValue ,'dbo' AS SchameName ,'trInvoiceHeader' AS TableName ,InvoiceHeaderID AS RowGuid ,'InvoiceHeaderID' AS PKeyColumnName ,CASE C.[__$operation] WHEN 1 THEN CAST(InvoiceHeaderID as nvarchar(37)) WHEN 2 THEN CAST(InvoiceHeaderID as nvarchar(37)) WHEN 4 THEN '' END AS PkeyNewValue ,CASE C.[__$operation] WHEN 1 THEN '' WHEN 2 THEN '' WHEN 4 THEN CAST(InvoiceHeaderID as nvarchar(37)) END AS PkeyOldValue ,CASE C.[__$operation] WHEN 1 THEN 'D' WHEN 2 THEN 'I' WHEN 4 THEN 'U' END AS Operation ,C.[LastUpdatedUserName] ,C.[CreatedDate] AS NebimCreatedDate ,C.[LastUpdatedDate] AS NebimLastUpdatedDate ,C.[CDCInsertedDate] AS CDCTableInsertedDate FROM [cdc].[dbo_trInvoiceHeader_CT] C WITH(NOLOCK) INNER JOIN [cdc].[lsn_time_mapping] T WITH(NOLOCK) ON C.[__$start_lsn]=T.[start_lsn] WHERE C.[__$seqval] > ( SELECT MAX(SeqValue) FROM dbr.DBA_CDClog WHERE TableName = 'trInvoiceHeader' ) AND C.[__$operation] IN (1,2,4) AND C.[LastUpdatedUserName] NOT IN ('uates','adminREPADMIN','admine','REPKETM','REPRETM') AND T.[tran_end_time] < DateAdd(minute, -1, getDate()) UNION ALL -- 9 trInvoiceLine Tablosu SELECT C.[__$seqval] AS SeqValue ,'dbo' AS SchameName ,'trInvoiceLine' AS TableName ,InvoiceLineID AS RowGuid ,'InvoiceLineID' AS PKeyColumnName ,CASE C.[__$operation] WHEN 1 THEN CAST(InvoiceLineID as nvarchar(37)) WHEN 2 THEN CAST(InvoiceLineID as nvarchar(37)) WHEN 4 THEN '' END AS PkeyNewValue ,CASE C.[__$operation] WHEN 1 THEN '' WHEN 2 THEN '' WHEN 4 THEN CAST(InvoiceLineID as nvarchar(37)) END AS PkeyOldValue ,CASE C.[__$operation] WHEN 1 THEN 'D' WHEN 2 THEN 'I' WHEN 4 THEN 'U' END AS Operation ,C.[LastUpdatedUserName] ,C.[CreatedDate] AS NebimCreatedDate ,C.[LastUpdatedDate] AS NebimLastUpdatedDate ,C.[CDCInsertedDate] AS CDCTableInsertedDate FROM [cdc].[dbo_trInvoiceLine_CT] C WITH(NOLOCK) INNER JOIN [cdc].[lsn_time_mapping] T ON C.[__$start_lsn]=T.[start_lsn] WHERE C.[__$seqval] > ( SELECT MAX(SeqValue) FROM dbr.DBA_CDClog WHERE TableName = 'trInvoiceLine' ) AND C.[__$operation] IN (1,2,4) AND C.[LastUpdatedUserName] NOT IN ('uates','adminREPADMIN','admine','REPKETM','REPRETM') AND T.[tran_end_time] < DateAdd(minute, -1, getDate()) UNION ALL -- 10 trPaymentHeader Tablosu SELECT C.[__$seqval] AS SeqValue ,'dbo' AS SchameName ,'trPaymentHeader' AS TableName ,PaymentHeaderID AS RowGuid ,'PaymentHeaderID' AS PKeyColumnName ,CASE C.[__$operation] WHEN 1 THEN CAST(PaymentHeaderID as nvarchar(37)) WHEN 2 THEN CAST(PaymentHeaderID as nvarchar(37)) WHEN 4 THEN '' END AS PkeyNewValue ,CASE C.[__$operation] WHEN 1 THEN '' WHEN 2 THEN '' WHEN 4 THEN CAST(PaymentHeaderID as nvarchar(37)) END AS PkeyOldValue ,CASE C.[__$operation] WHEN 1 THEN 'D' WHEN 2 THEN 'I' WHEN 4 THEN 'U' END AS Operation ,C.[LastUpdatedUserName] ,C.[CreatedDate] AS NebimCreatedDate ,C.[LastUpdatedDate] AS NebimLastUpdatedDate ,C.[CDCInsertedDate] AS CDCTableInsertedDate FROM [cdc].[dbo_trPaymentHeader_CT] C WITH(NOLOCK) INNER JOIN [cdc].[lsn_time_mapping] T WITH(NOLOCK) ON C.[__$start_lsn]=T.[start_lsn] WHERE C.[__$seqval] > ( SELECT MAX(SeqValue) FROM dbr.DBA_CDClog WHERE TableName = 'trPaymentHeader' ) AND C.[__$operation] IN (1,2,4) AND C.[LastUpdatedUserName] NOT IN ('uates','adminREPADMIN','admine','REPKETM','REPRETM') AND T.[tran_end_time] < DateAdd(minute, -1, getDate()) UNION ALL -- 11 trPaymentLine Tablosu SELECT C.[__$seqval] AS SeqValue ,'dbo' AS SchameName ,'trPaymentLine' AS TableName ,PaymentLineID AS RowGuid ,'PaymentLineID' AS PKeyColumnName ,CASE C.[__$operation] WHEN 1 THEN CAST(PaymentLineID as nvarchar(37)) WHEN 2 THEN CAST(PaymentLineID as nvarchar(37)) WHEN 4 THEN '' END AS PkeyNewValue ,CASE C.[__$operation] WHEN 1 THEN '' WHEN 2 THEN '' WHEN 4 THEN CAST(PaymentLineID as nvarchar(37)) END AS PkeyOldValue ,CASE C.[__$operation] WHEN 1 THEN 'D' WHEN 2 THEN 'I' WHEN 4 THEN 'U' END AS Operation ,C.[LastUpdatedUserName] ,C.[CreatedDate] AS NebimCreatedDate ,C.[LastUpdatedDate] AS NebimLastUpdatedDate ,C.[CDCInsertedDate] AS CDCTableInsertedDate FROM [cdc].[dbo_trPaymentLine_CT] C WITH(NOLOCK) INNER JOIN [cdc].[lsn_time_mapping] T WITH(NOLOCK) ON C.[__$start_lsn]=T.[start_lsn] WHERE C.[__$seqval] > ( SELECT MAX(SeqValue) FROM dbr.DBA_CDClog WHERE TableName = 'trPaymentLine' ) AND C.[__$operation] IN (1,2,4) AND C.[LastUpdatedUserName] NOT IN ('uates','adminREPADMIN','admine','REPKETM','REPRETM') AND T.[tran_end_time] < DateAdd(minute, -1, getDate()) UNION ALL -- 12 trBankLineCurrency tablosunda, Umit sadece UPDATE olan kayitlari istedi.31-05-2016 -- Faturada ki ödeme kalemleri değiştirilen kayıtları alıyoruz. C.[__$operation] IN (4) Cüneyte sevgiler. Turplu SELECT C.[__$seqval] AS SeqValue ,'dbo' AS SchameName ,'trBankLineCurrency' AS TableName ,BankLineID AS RowGuid ,'BankLineID||CurrencyCode' AS PKeyColumnName ,CASE C.[__$operation] WHEN 1 THEN CAST(BankLineID as nvarchar(37))+'||'+CAST(CurrencyCode as nvarchar(10)) WHEN 2 THEN CAST(BankLineID as nvarchar(37))+'||'+CAST(CurrencyCode as nvarchar(10)) WHEN 4 THEN '' END AS PkeyNewValue ,CASE C.[__$operation] WHEN 1 THEN '' WHEN 2 THEN '' WHEN 4 THEN CAST(BankLineID as nvarchar(37))+'||'+CAST(CurrencyCode as nvarchar(10)) END AS PkeyOldValue ,CASE C.[__$operation] WHEN 1 THEN 'D' WHEN 2 THEN 'I' WHEN 4 THEN 'U' END AS Operation ,C.[LastUpdatedUserName] ,C.[CreatedDate] AS NebimCreatedDate ,C.[LastUpdatedDate] AS NebimLastUpdatedDate ,C.[CDCInsertedDate] AS CDCTableInsertedDate FROM [cdc].[dbo_trBankLineCurrency_CT] C WITH(NOLOCK) INNER JOIN [cdc].[lsn_time_mapping] T WITH(NOLOCK) ON C.[__$start_lsn]=T.[start_lsn] WHERE C.[__$seqval] > ( SELECT MAX(SeqValue) FROM dbr.DBA_CDClog WHERE TableName = 'trBankLineCurrency' ) AND C.[__$operation] = 4 AND C.[LastUpdatedUserName] NOT IN ('uates','adminREPADMIN','admine','REPKETM','REPRETM') AND T.[tran_end_time] < DateAdd(minute, -1, getDate()) UNION ALL -- 13 trPaymentLine Tablosu SELECT C.[__$seqval] AS SeqValue ,'dbo' AS SchameName ,'prCurrAccOptInOptOutStatus' AS TableName ,CommunicationID AS RowGuid ,'CommunicationID' AS PKeyColumnName ,CASE C.[__$operation] WHEN 1 THEN CAST(CommunicationID as nvarchar(37)) WHEN 2 THEN CAST(CommunicationID as nvarchar(37)) WHEN 4 THEN '' END AS PkeyNewValue ,CASE C.[__$operation] WHEN 1 THEN '' WHEN 2 THEN '' WHEN 4 THEN CAST(CommunicationID as nvarchar(37)) END AS PkeyOldValue ,CASE C.[__$operation] WHEN 1 THEN 'D' WHEN 2 THEN 'I' WHEN 4 THEN 'U' END AS Operation ,C.[LastUpdatedUserName] ,C.[CreatedDate] AS NebimCreatedDate ,C.[LastUpdatedDate] AS NebimLastUpdatedDate ,C.[CDCInsertedDate] AS CDCTableInsertedDate FROM [cdc].[dbo_prCurrAccOptInOptOutStatus_CT] C WITH(NOLOCK) INNER JOIN [cdc].[lsn_time_mapping] T WITH(NOLOCK) ON C.[__$start_lsn]=T.[start_lsn] WHERE C.[__$seqval] > ( SELECT MAX(SeqValue) FROM dbr.DBA_CDClog WHERE TableName = 'prCurrAccOptInOptOutStatus' ) AND C.[__$operation] IN (1,2,4) AND C.[LastUpdatedUserName] NOT IN ('uates','adminREPADMIN','admine','REPKETM','REPRETM') AND T.[tran_end_time] < DateAdd(minute, -1, getDate()) OPTION (MAXDOP 1) END TRY BEGIN CATCH IF @@TRANCOUNT>0 ROLLBACK TRANSACTION; INSERT INTO [DBACHECKDB].[dbo].[DBATryCatchErrorLog] SELECT ERROR_NUMBER() AS ErrorNumber ,ERROR_SEVERITY() AS ErrorSeverity ,ERROR_STATE() AS ErrorState ,ERROR_PROCEDURE() AS ErrorProcedure ,'dba_Replicator' AS 'SPName' ,ERROR_LINE() AS ErrorLine ,ERROR_MESSAGE() AS ErrorMessage ,'0' AS Ismailed ,GETDATE(); END CATCH; END