Change tracking must be enabled on database 'AxDB' before it can be enabled on table 'RETAILCHANNELTABLE'.

Change tracking must be enabled on database 'AxDB' before it can be enabled on table 'RETAILCHANNELTABLE'.

Song Nghia - Technical Consultant

Step 0. Change AXDB



Step 1. Script split string

/****** Object:  UserDefinedFunction [dbo].[SplitString]    Script Date: 11/19/2016 12:14:03 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE FUNCTION [dbo].[SplitString]
(    
      @Input NVARCHAR(MAX),
      @Character CHAR(1)
)
RETURNS @Output TABLE (
      Item NVARCHAR(max)
)
AS
BEGIN
      DECLARE @StartIndex INT, @EndIndex INT
 
      SET @StartIndex = 1
      IF SUBSTRING(@Input, LEN(@Input) - 1, LEN(@Input)) <> @Character
      BEGIN
            SET @Input = @Input + @Character
      END
 
      WHILE CHARINDEX(@Character, @Input) > 0
      BEGIN
            SET @EndIndex = CHARINDEX(@Character, @Input)
           
            INSERT INTO @Output(Item)
            SELECT SUBSTRING(@Input, @StartIndex, @EndIndex - 1)
           
            SET @Input = SUBSTRING(@Input, @EndIndex + 1, LEN(@Input))
      END
 
      RETURN
END

GO

Script enable tracking
DECLARE @ChangeTrackingTables NVARCHAR(MAX)
DECLARE @TableName NVARCHAR(250)
DECLARE @Sql NVARCHAR(500)

SET @ChangeTrackingTables = 'CUSTPARAMETERS,LOGISTICSLOCATION,USERINFO,RETAILPERMISSIONSEX,RETAILSTORETENDERTYPETABLE,TAXRUNTIMEDOCCOMPONENTMEASURE,RETAILONLINECHANNELPUBLISHSTATUS,FISCALESTABLISHMENTINVENTSITE_BR,RETAILREPORTPERMISSIONGROUP,LOGISTICSADDRESSPARAMETERS,RETAILDLVMODEPRODUCTLINE,RETAILCONFIGURATIONPARAMETERS,RETAILFUNCTIONALITYPROFILEFISCALINTEGRATIONTECHNICALPROFILELINE,RETAILPERMISSIONS,RETAILKITCOMPONENTSUBSTITUTE,ECORESENUMERATIONATTRIBUTETYPEVALUE,RETAILLOCALIZEDTEXT,RETAILSALESTAXOVERRIDEGROUPMEMBER,TAXRUNTIMEDOCCOMPONENTPOSTINGTYPE,RETAILTABLEIDTABLE,TAXREGISTRATIONLEGISLATIONTYPES,TAXRUNTIMEREFERENCEMODELROW,TAXRUNTIMEDOCMODELROWMEASURE,DIRPARTYLOCATIONROLE,TAXCOMPONENTTABLE_IN,LOGISTICSADDRESSSTATE,RETAILONLINECHANNELFUNCTIONALITYPROFILETABLE,TAXRUNTIMETAXTYPEVERSION,AGREEMENTHEADEREXT_RU,RETAILKITCOMPONENT,TAXRUNTIMEDOCMODELATTR,FISCALESTABLISHMENT_BR,LEDGERVOUCHERTYPE_CN,RETAILDLVMODEADDRESSEXPLODED,WHSLOCATIONPROFILE,MAINACCOUNTCATEGORY,RETAILEXTERNALIDTOCUSTOMERMAP,ERVENDORTABLE,SMMCAMPAIGNTABLE,FISCALCALENDARPERIOD,RETAILTILLLAYOUTSTORE,RETAILAFFILIATION,RETAILASSORTMENTLOOKUPCHANNELGROUP,RETAILOFFLINESCOPE,RETAILEVENTNOTIFICATIONPROFILE,INVENTITEMGROUP,TAXRUNTIMELOOKUPMEASURERESULT,LOGISTICSADDRESSFORMATHEADING,RETAILINCOMEEXPENSEACCOUNTTABLE,ERTEXTFORMATVERSIONTABLE,LOGISTICSADDRESSFORMATLINES,RETAILOFFLINETABLECOLUMNS,MARKUPAUTOTABLE,ECORESATTRIBUTEGROUP,GENERALJOURNALENTRY,RETAILPOSPERMISSIONGROUP,TAXRUNTIMEMODEL,ACCOUNTANT_BR,RETAILCUSTOMERSEARCHFIELD,TAXRUNTIMEDOCTAXTYPEPOSTINGTYPE,RETAILCOUPON,DIMENSIONATTRIBUTEVALUETOTALLINGCRITERIA,RETAILOFFLINETABLE,ECORESPRODUCTTRANSLATION,TAXSOLUTIONSCOPE,SHIPCARRIERSTAGING,PRICEPARAMETERS,LOGISTICSADDRESSCITY,LEDGERFUND,ECORESVALUE,RETAILSHAREDBINGPARAMETERS,PLFISCALTAXTABLE,TAXRUNTIMEREFERENCEMODELROWVERSION,INVENTITEMGTIN,TAXRUNTIMEDOCCOMPONENTMEASUREVERSION,RETAILKEYBOARDMAPPINGTABLE,DOCUVALUE,RETAILPUBPRODUCTATTRIBUTECHANNELMETADATA,SYSTEMPARAMETERS,TAXRUNTIMECOMPONENTMEASURE,RETAILINVENTLINKEDITEM,TAXRUNTIMELOOKUPMEASURERESULTDETAIL,RETAILCHANNELREPORT,INVENTITEMBARCODE,SYSTASKRECORDERINDUSTRY,TAXRUNTIMEDOCMODELROWMEASUREVERSION,TAXRUNTIMEDOCMODELATTRVERSION,RETAILSTOREHOURSTEMPLATE,RETAILINFOCODEFISCALTEXT,RETAILRELYINGPARTY,RETAILTHEMEPALLET,RETAILTERMINALTABLE,ECORESPRODUCTMASTERDIMENSIONVALUE,TAXRUNTIMEMODELATTR,PROJTABLE,TAXRUNTIMELOOKUPSTRUCTUREFIELDVERSION,RETAILHARDWAREPROFILEFISCALINTEGRATIONTECHNICALPROFILELINE,RETAILCHANNELTABLE,LEDGERJOURNALTRANS,LOGISTICSADDRESSCOUNTRYREGION,RETURNREASONCODEGROUP,RETAILKITVARIANTCOMPONENT,RETAILINFORMATIONSUBCODETABLE,RETAILCHANNELPROFILE,ECORESCATEGORYTRANSLATION,ECORESATTRIBUTEDEFAULTVALUE,TAXSOLUTIONSCOPESETUP,ECORESATTRIBUTEVALUE,RETAILCHANNELCURRENCY,COMPANYDEFAULTLOCATION,RETAILTRANSACTIONORDERSTATUS,ECORESPRODUCTCATEGORY,RETAILSHIPCARRIERACCOUNTCONFIGURATION,TAXREGISTRATIONTYPEAPPLICABILITYRULE,BUDGETPLANHEADER,RETAILPUBCHANNELATTRIBUTE,RETAILLOYALTYSCHEMECHANNEL,RETAILPUBINTERNALORGATTRIBUTEGROUP,TAXPOVERTYFUNDSETUPDATA_BR,LOGISTICSADDRESSCOUNTY,RETAILSTORETENDERTYPECARDTABLE,HCMJOB,RETAILINFOCODETRANSLATION,DLVMODE,RETAILPUBCATALOG,PROVISIONINGMESSAGETABLE,RETAILLOYALTYSCHEME,INVENTDIMCOMBINATION,TAXRTDOCCOMPFORMULACOMPMEASURE,SERVICEACCOUNTINGCODETABLE_IN,RETAILPUBCATALOGPRODUCTCATEGORY,RETAILSPECIALCATEGORYMEMBER,MARKUPTABLE_IN,COMMISSIONSALESGROUP,ECORESSIZE,RETAILCOUPONCODETABLE,TAXRUNTIMEDOCMODELROW,TAXRUNTIMECOMPONENTMEASUREVERSION,TAXRUNTIMELOOKUPTAXCURRENCYRESULT,TAXRUNTIMELOOKUPSTRUCTUREVERSION,RETURNREASONCODE,RETAILSALESTAXOVERRIDE,TAXSUBSTITUTIONCODETABLE_BR,ECORESPRODUCTRELATIONTYPE,TAXRUNTIMEMODELATTRVERSION,HCMPOSITIONDETAIL,RETAILDISCOUNTVALIDATIONPERIOD,INVENTLOCATIONLOGISTICSLOCATIONROLE,TAXBURDEN_BR,TAXRUNTIMEDOCCOMPONENTPOSTINGPROFILE,RETAILPERIODICDISCOUNT,COMMISSIONSALESREP,RETAILDISCOUNTTHRESHOLDTIERS,RETAILSTORELOCATORGROUP,RETAILPUBRETAILCATALOGPRICEGROUP,RETAILDEVICE,ACCOUNTANTLOGISTICSLOCATION_BR,DIMENSIONATTRIBUTEVALUE,RETAILCHANNELTABLE_IN,JMGIPCACTIVITY,RETAILKEYBOARDMAPPINGTRANS,RETAILPERIODICDISCOUNTLINE,TAXRTDOCCOMPPOSTINGPROFDETVERSION,RETAILFISCALINTEGRATIONREGISTRATIONPROCESS,RETAILCUSTOMERSEARCHFIELDTRANSLATION,RETAILCATEGORYCONTAINMENTLOOKUP,LOGISTICSADDRESSZIPCODE,RETAILSHIPCARRIERINTERFACE,ECORESCATEGORYATTRIBUTEGROUP,DIMENSIONATTRVALUELEDGEROVERRIDE,ECORESATTRIBUTETYPE,CUSTGROUP,TAXRUNTIMELOOKUPVERSION,BUDGETTRANSACTIONLINE,ECORESPRODUCTIMAGE,RETAILLOYALTYREWARDPOINT,RETAILLOYALTYEARNSCHEMELINE,CUSTPACKINGSLIPJOUR,BUDGETSOURCETRACKINGRELIEVINGDETAIL,TAXPOVERTYFUNDSETUPHEADING_BR,ECORESTEXTVALUETRANSLATION,RETAILCDXDATASTORECHANNEL,ECORESPRODUCTRELATIONTABLE,RETAILATTACHEDSERVICEMASTER,RETAILAFFILIATIONPRICEGROUP,TAXRUNTIMELOOKUPACCOUNTINGRESULT,TAXRUNTIMEDOCCOMPONENTPOSTINGPROFILEDET,TAXRUNTIMEREFERENCEMODEL,ECORESBOUNDEDATTRIBUTETYPEVALUE,RETAILFISCALINTEGRATIONREGISTRATIONPROCESSLINE,RETAILTENDERTYPETABLE,TAXRUNTIMEDOCMODELROWVERSION,RETAILDISCOUNTFISCALTEXT,OMEXPLODEDORGANIZATIONSECURITYGRAPH,TAXREGISTRATIONTYPE,TAXRUNTIMECOMPONENTVERSION,LEDGER,RETAILNOTIFICATIONSUBSCRIPTIONS,RETAILPUBCATALOGPRODUCTRELATION,RETAILSERVERRESOURCE,RETAILLOYALTYREDEEMSCHEMELINE,EFDOCWEBSERVICEPARAMETERS_BR,RETAILMIXANDMATCHLINEGROUPS,INVENTTABLE,TAXDOCUMENTROWMEASUREADJUSTMENT,INVENTITEMSALESSETUP,DIMENSIONATTRIBUTEVALUECOMBINATION,RETAILDRAWERPOOLDEVICE,EXCHANGERATECURRENCYPAIR,BUDGETMODEL,WHSINVENTSTATUS,RETAILKITRELEASEDSUBSTITUTECHARGE,RETAILPUBECORESCATEGORY,RETAILSTORESAFE,ERSOLUTIONVERSIONTABLE,RETAILDRAWERPOOL,TAXRUNTIMEREFERENCEMODELVERSION,RETAILSHAREDPARAMETERS,RETAILRECEIPTPROFILE,RETAILGROUPMEMBERLINE,RETAILSTORELOCATORGROUPMEMBER,RETAILPUBRETAILCHANNELCATEGORYATTRIBUTE,TAXRUNTIMELOOKUPTAXPERIODRESULT,TAXRUNTIMELOOKUPACCOUNTINGRESULTDETAIL,BUDGETPLANNINGPROCESS,DIRADDRESSBOOK,RETAILUNIT,RETAILDISCOUNTCODE,RETAILFISCALINTEGRATIONCONNECTORTABLE,RETAILPERMISSIONSGROUP,RETAILLOYALTYCARDTIER,RETAILTILLLAYOUTZONE,LOGISTICSPOSTALADDRESS,RETAILPOSTHEME,RETAILSTOREHOURSCHANNEL,TAXRTDOCCOMPPOSTINGPROFVERSION,RETAILHARDWAREPROFILE,LOGISTICSADDRESSCOUNTRYREGIONTRANSLATION,RETAILPUBCATALOGTRANSLATION,TAXRUNTIMEDEFCONTEXT,INVENTSITEDEFAULTLOCATION,INVENTDIM,RETAILKEYBOARDBUTTONCONTROLB,LEDGERCOV,RETAILCHANNELPROFILEPROPERTY,INVENTSITELOGISTICSLOCATIONROLE,RETAILLABELCHANGEJOURNALTRANS,LANGUAGETABLE,RETAILTILLLAYOUTZONEREFERENCE,RETAILINVENTAVAILABILITYPARAMETERS,ERSOLUTIONTABLE,RETAILCHANNELPAYMENTCONNECTORLINE,RETAILTERMINALDEVICE,BUDGETPLANPRIORITY,TAXRUNTIMEMODELROW,RETAILLOYALTYTIERTRANSLATION,TAXRUNTIMEDOCMODELVERSION,ECORESPRODUCT,RETAILRECEIPTPROFILELINE,DIMENSIONATTRIBUTE,RETAILTABLEFIELDID,TAXCOLLECTLIMIT,INVENTLOCATIONLOGISTICSLOCATION,RETAILLOYALTYTIER,TAXPARAMETERS,RETAILPUBINTORGINHERITANCEEXPLODED,UNITOFMEASURECONVERSION,RETAILCHANNELATTRIBUTEGROUP,RETAILLOYALTYCARD,RETAILSTORECASHDECLARATIONTABLE,RETAILTAXFILTERS,TAXRUNTIMELOOKUP,RETAILINFOCODE,MAINACCOUNTLEGALENTITY,SYSSERVICECONFIGURATIONSETTING,RETAILBARCODEMASKCHARACTER,RETAILDEVICETYPES,TAXATIONCODESETUP_BR,TAXRTLOOKUPSTRUCTFIELDBINDINGVERSION,RETAILDLVMODEPRODUCTEXPLODED,ECORESCOLOR,ECORESSTYLE,SYSTASKRECORDERLINEARTIFACT,RETAILCONNDATABASEPROFILE,TAXDATA,TAXRUNTIMEDEFCONTEXTVERSION,DIRADDRESSBOOKPARTY,RETAILPUBPRODUCTATTRIBUTEVALUE,ECORESPRODUCTVARIANTDIMENSIONVALUE,RETAILLOYALTYOTHERACTIVITYTYPE,TAXATIONCODETABLE_BR,RETAILTILLLAYOUTSTAFF,RETAILINVENTAVAILABILITY,RETAILVISUALPROFILE,DOCUREF,RETAILPARAMETERS,ACCOUNTANTLOGISTICSLOCATIONROLE_BR,RETAILOFFLINEPROFILESCOPES,RETAILINFOCODETABLE,TAXENGINESQLDICTIONARY,ERDATAMODELVERSIONTABLE,SYSTASKRECORDERPARAMETERS,TAXRUNTIMEDOCTAXTYPE,TAXBRANCH,RETAILFISCALINTEGRATIONTECHNICALPROFILE,TAXBENEFITCODESETUPDATA_BR,RETAILCONFIGURATION_BR,RETAILPOSITIONNOTIFICATIONSUBSCRIPTIONS,FBFISCALDOCUMENTADJUSTMENTCODEICMS_BR,RETAILATTRIBUTEMETADATA,BANKACCOUNTTABLE,ECORESTRACKINGDIMENSIONGROUPITEM,RETAILHARDWARECONFIGURATION,ECORESPRODUCTMASTERDIMVALUETRANSLATION,DIMENSIONFINANCIALTAG,TAXRUNTIMEMODELROWVERSION,FORMULADESIGNER_IN,RETAILPUBCATALOGPRODUCT,RETAILFISCALINTEGRATIONDOCUMENTPROVIDERTABLE,TAXPERIODHEADER,RETAILPOSITIONPOSPERMISSION,RETAILFORMLAYOUT,RETAILSTOREHOURSRANGE,SYSTASKRECORDERFRAMEWORKLEVEL,RETAILTENDERTYPECARDNUMBERS,TAXRUNTIMELOOKUPSTRUCTURE,TAXRUNTIMEDOCCOMPONENT,TAXSOLUTIONSCOPECHANGEHISTORY,MARKUPAUTOLINE,SYSTASKRECORDERFRAMEWORKLINE,TAXGROUPHEADING,BRAZILPARAMETERS,TAXFISCALCLASSIFICATION_BR,RETAILPUBRETAILCHANNELTABLE,LOGISTICSLOCATIONROLE,ECORESATTRIBUTEGROUPTRANSLATION,HCMPOSITION,TAXRTLOOKUPSTRUCTFIELDCONDCOLUMNLINK,RETAILBARCODEMASKTABLE,TAXMEASURETYPE,RETAILPOSSEEDDATA,RETAILIDENTITYPROVIDER,RETAILASSORTMENTPRODUCTLINE,RETAILMULTIBUYDISCOUNTLINE,RETAILENUMVALUETABLE,CUSTTABLE,FISCALCALENDARYEAR,RETAILOFFLINESCOPETABLES,RETAILPUBECORESCATEGORYTRANSLATION,RETAILLANGUAGETEXT,LANGUAGETXT,RETAILOPERATIONS,LOGISTICSELECTRONICADDRESS,TAXRUNTIMEDOCTAXTYPEVERSION,TAXTABLE,TAXRUNTIMEDOCCOMPONENTVERSION,ECORESATTRIBUTEGROUPATTRIBUTE,TAXRUNTIMELOOKUPCONDITION,HSNCODETABLE_IN,DIRPARTYTABLE,SALESPARAMETERS,LOGISTICSLOCATIONROLETRANSLATION,RETAILINTERNALORGANIZATION,ERTEXTFORMATTABLE,ECORESATTRIBUTE,TAXRUNTIMELOOKUPSTRUCTUREBINDING,RETAILBUTTONGRID,TAXDOCUMENTROWDETERMINEDCOMPONENT,RETAILSTORELOCATORGROUPOWNER,BUDGETSOURCE,TAXINFORMATIONCUSTTABLE_IN,RETAILFISCALPRINTERCONFIGTABLE,BUDGETCONTROLBUDGETCYCLE,TAXBENEFITCODESETUPHEADING_BR,TAXRUNTIMEMODELVERSION,BUDGETCYCLE,RETAILMEDIAPRODUCTRELATION,BUDGETPLANSCENARIO,TAXINFORMATION_IN,RETAILRECEIPTMASKS,RETAILPUBRETAILONLINECHANNELLANGUAGES,BUDGETSOURCETRACKING,RETAILTERMINALCOUNTER,RETAILBUTTONGRIDBUTTONS,HCMWORKER,INVENTSITELOGISTICSLOCATION,WMSLOCATION,RETAILEVENTNOTIFICATIONSETTING,TAXINFORMATIONLEGALENTITY_IN,ECORESCATEGORYHIERARCHY,BUDGETPLANLINE,RETAILTILLLAYOUT,RETAILCHANNELPRICEGROUP,DIMENSIONATTRVALUECOAOVERRIDE,ECORESPRODUCTDIMENSIONGROUPPRODUCT,RETAILINFOCODETABLESPECIFIC,WHSLICENSEPLATE,RETAILSTAFFEXTENDEDLOGON,RETAILMEDIAANDMASTERENTITYRELATION,RETAILSTAFFDEFAULTCOMMISSIONSALESGROUP,CUSTPACKINGSLIPTRANS,RETAILSTOREADDRESSBOOK,INVENTSERIAL,RETAILCHANNELTABLEEXT,INVENTITEMGROUPITEM,LOGISTICSADDRESSDISTRICT,RETAILREPORTLOCALIZEDSTRING,RETAILOFFLINEDATAEXPORTSCHEDULE,TAXRUNTIMEDOCCONTEXT,DIRPARTYLOCATION,TAXREGISTRATIONNUMBERS_IN,TAXMEASURETYPEDETAIL,TAXRUNTIMEPOSTINGTYPE,TAXRUNTIMELOOKUPSTRUCTUREBINDINGVERSION,RETAILKEYBOARDBUTTONCONTROL,RETAILLOYALTYSCHEMEEXCLUDEDAFFILIATION,RETAILFISCALINTEGRATIONFUNCTIONALITYPROFILE,RETAILTRANSACTIONSERVICEPROFILE,LOGISTICSLOCATIONEXT,CFOPGROUP_BR,RETAILATTRIBUTEFILTER,ECORESINSTANCEVALUE,RETAILLOYALTYSCHEMECHANNELEXPLODED,RETAILINFOCODEGROUP,EXCHANGERATETYPE,EXCEPTIONCODETABLE_BR,FISCALDOCUMENTSOURCETEXT_BR,RETAILCUSTAFFILIATION,RETAILASSORTMENTLOOKUP,RETAILTILLLAYOUTCONFIGURATION,RETAILPUBCATALOGPRODUCTRELATIONEXCLUSION,BUDGETTRANSACTIONHEADER,RETAILIMAGES,PRICEDISCGROUP,ECORESTRACKINGDIMENSIONGROUPFLDSETUP,LEDGERENTRYJOURNAL,RETAILTERMINALCUSTOMFIELD,ECORESCATEGORYATTRIBUTELOOKUP,TAXRUNTIMEREFERENCEMODELATTR,RETAILTHEMEACCENT,INVENTTABLEMODULE,ERSOLUTIONTEXTFORMATVERSIONTABLE,RETAILPUBINVENTDIMCHANNELMETADATA,ECORESCONFIGURATION,GENERALJOURNALACCOUNTENTRY,RETAILCUSTTABLE,RETAILINFORMATIONSUBCODETRANSLATION,RETAILMEDIATEMPLATE,RETAILDISCOUNTPRICEGROUP,RETAILSTOREHARDWARESTATIONTABLE,TAXDOCUMENTROWTAXDETERMINEDINFO,WHSPARAMETERS,BUDGETCONTROLCONFIGURATION,RETAILAFFILIATIONTRANSLATION,LEDGERFISCALCALENDARPERIOD,SYSTASKRECORDERFRAMEWORK,ECORESCATEGORYHIERARCHYROLE,EFDOCAUTHORITY_BR,SHIPCARRIERTABLE,TAXRUNTIMEPOSTINGTYPEVERSION,INVENTLOCATION,INVENTLOCATIONDEFAULTLOCATION,RETAILSALESTAXOVERRIDEGROUP,TAXRUNTIMEDOCCONTEXTVERSION,TAXSOLUTIONINFO,SHIPCARRIERCOMPANYACCOUNTS,MARKUPTABLE,TAXRUNTIMEMEASURE,TAXRUNTIMELOOKUPSTRUCTUREFIELD,ERDATAMODELTABLE,BUDGETSOURCETRACKINGDETAIL,GENERALJOURNALENTRY_W,TAXONITEM,RETAILPRODUCTRATING,RETAILINVENTTABLE,RETAILPUBCATALOGINTERNALORG,RETAILFISCALINTEGRATIONFUNCTIONALITYPROFILEGROUP,RETAILSTORETABLE_IN,RETAILDLVMODECHANNELEXPLODED,RETAILCONFIGURATIONSTORETABLE_BR,TAXRUNTIMECOMPONENT,HCMPOSITIONWORKERASSIGNMENT,LEDGERJOURNALTABLE,OMHIERARCHYPURPOSE,RETAILFUNCTIONALITYPROFILE,CURRENCY,MAINACCOUNT,RETAILBARCODEMASKSEGMENT,RETAILOFFLINECUSTOMERADDRESSFILTER,RETAILSTANDARDATTRIBUTE,TIMEZONEINFO,BARCODESETUP,TAXGROUPDATA,RETAILSTAFFTABLE,RETAILJOBPOSPERMISSIONGROUP,EXCHANGERATE,CFOPMATRIX_BR,RETAILMEDIARESOURCE,TAXRUNTIMEREFERENCEMODELATTRVERSION,RETAILINFOCODEGROUPSPECIFIC,RETAILOFFLINEPROFILE,SYSTASKRECORDERFRAMEWORKINDUSTRYMAP,RETAILTHEMEACCENTCOLOR,RETAILHARDWARESTATION,UNITOFMEASURETRANSLATION,DIRPERSONNAME,TAXRUNTIMEDOCMODEL,ECORESTRACKINGDIMENSIONGROUPPRODUCT,OMHIERARCHYCHANGELOG,TAXREGISTRATION,TAXRUNTIMETAXTYPE,ECORESATTRIBUTETYPEUNITOFMEASURE,RETAILATTACHEDSERVICE,RETAILLOYALTYREWARDPOINTTRANSLATION,RETAILFISCALINTEGRATIONFUNCTIONALITYPROFILEGROUPLINE,INVENTSITE,RETAILOFFLINEPRODUCTSCATEGORY,ECORESATTRIBUTETRANSLATION,RETAILTENDERTYPECARDTABLE,EFDRETURNCODE_BR,ECORESCATEGORY,PRICEDISCTABLE,RETAILKIT,TAXRUNTIMELOOKUPSTRUCTUREFIELDBINDING,BUDGETPLANNINGSTAGE,RETAILSTAFFCREDENTIALTABLE,RETAILTILLLAYOUTSIZE,RETAILCONNPARAMETERS,TAXRUNTIMEMEASUREVERSION,CFOPTABLE_BR,FISCALESTABLISHMENTGROUP_BR,UNITOFMEASURE';

DECLARE @getTableName CURSOR
SET @getTableName = CURSOR FOR
SELECT Item
FROM dbo.SplitString(@ChangeTrackingTables, ',')
OPEN @getTableName
FETCH NEXT
FROM @getTableName INTO @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
 SET @Sql  = ' IF (SELECT CASE (SELECT 1 WHERE '
 SET @Sql += QUOTENAME(@TableName,'''')
 SET @Sql += ' IN (SELECT OBJECT_NAME(object_id) [TABLE_NAME] FROM sys.change_tracking_tables)) WHEN 1 THEN 1 ELSE 0 END) = 0'
 SET @Sql += ' BEGIN '
 SET @Sql += ' ALTER TABLE '
 SET @Sql += @TableName
 SET @Sql += ' ENABLE CHANGE_TRACKING WITH (TRACK_COLUMNS_UPDATED = OFF); '
 SET @Sql += ' END '

 PRINT @Sql
EXEC (@Sql)
FETCH NEXT
FROM @getTableName INTO @TableName
END
CLOSE @getTableName
DEALLOCATE @getTableName


Full sync Database Dynamic 365
Previous Post
Next Post

post written by: