/**Begin D:\PDM_UPGRADE\PDM1\EB_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_EB_BASECVTFORMULA', 'T_EB_BASECVTFORMULA', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_BASECVTF_MODEL') CREATE INDEX IDX_EB_BASECVTF_MODEL ON T_EB_BASECVTFORMULA ( FMODELID ,FSCENARIOID );


 EXEC P_ALTERPK 'PK_T_EB_BEGINPERIODDIMS', 'T_EB_BEGINPERIODDIMS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_BEGINPERIODDIMS') CREATE INDEX IDX_EB_BEGINPERIODDIMS ON T_EB_BEGINPERIODDIMS ( FMODELID );


 EXEC P_ALTERPK 'PK_T_EB_BREXECINFO', 'T_EB_BREXECINFO', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_EXECINFO_MODEL') CREATE INDEX IDX_EB_EXECINFO_MODEL ON T_EB_BREXECINFO ( FMODELID );


 EXEC P_ALTERPK 'PK_T_EB_CONFIGSETTING', 'T_EB_CONFIGSETTING', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_CONFIGSETTING_NUM') CREATE INDEX IDX_EB_CONFIGSETTING_NUM ON T_EB_CONFIGSETTING ( FNUMBER );


 EXEC P_ALTERPK 'PK_T_EB_DISTRIBUTION', 'T_EB_DISTRIBUTION', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_DISTRIBUTION_MODELID') CREATE INDEX IDX_EB_DISTRIBUTION_MODELID ON T_EB_DISTRIBUTION ( FMODEL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_DISTRIBUTION_TEM') CREATE INDEX IDX_EB_DISTRIBUTION_TEM ON T_EB_DISTRIBUTION ( FTEMPLATE );


 EXEC P_ALTERPK 'PK_T_EB_EBAPPROVEBILL', 'T_EB_EBAPPROVEBILL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_EBAPPROVEBILL_MODEL') CREATE INDEX IDX_EB_EBAPPROVEBILL_MODEL ON T_EB_EBAPPROVEBILL ( FMODELID );


 EXEC P_ALTERPK 'PK_T_EB_EBAPPROVEBILLENTRY', 'T_EB_EBAPPROVEBILLENTRY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_EBAPPROVEBILLENTRY_FID') CREATE INDEX IDX_EB_EBAPPROVEBILLENTRY_FID ON T_EB_EBAPPROVEBILLENTRY ( FID );


 EXEC P_ALTERPK 'PK_T_EB_EBBIZRULEGLOBAL', 'T_EB_EBBIZRULEGLOBAL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_EBBIZRULEGLO_MODEL') CREATE INDEX IDX_EB_EBBIZRULEGLO_MODEL ON T_EB_EBBIZRULEGLOBAL ( FMODELID );


 EXEC P_ALTERPK 'PK_T_EB_EBTEMPLATE', 'T_EB_EBTEMPLATE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_EBTEMPLATE_NUMMODID') CREATE INDEX IDX_EB_EBTEMPLATE_NUMMODID ON T_EB_EBTEMPLATE ( FNUMBER ,FMODELID );


 EXEC P_ALTERPK 'PK_T_EB_EBTEMPLATE_L', 'T_EB_EBTEMPLATE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_EB_EBTEMPLATE_L_FLOCAL') CREATE INDEX IDX_T_EB_EBTEMPLATE_L_FLOCAL ON T_EB_EBTEMPLATE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_EB_EBTEMPLATECATALOG', 'T_EB_EBTEMPLATECATALOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_EBCATALOG_MODELID') CREATE INDEX IDX_EB_EBCATALOG_MODELID ON T_EB_EBTEMPLATECATALOG ( FMODELID );


 EXEC P_ALTERPK 'PK_T_EB_EBTEMPLATECATALOG_L', 'T_EB_EBTEMPLATECATALOG_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_EBCATALOG_LL_NUMMODID') CREATE INDEX IDX_EB_EBCATALOG_LL_NUMMODID ON T_EB_EBTEMPLATECATALOG_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_EB_FORMULAREGISTER', 'T_EB_FORMULAREGISTER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_FORMULAREGISTER') CREATE INDEX IDX_EB_FORMULAREGISTER ON T_EB_FORMULAREGISTER ( FCLOUDID ,FAPPID );


 EXEC P_ALTERPK 'PK_T_EB_INTERGRATION', 'T_EB_INTERGRATION', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_INTERGRATE_TMPL_SCEID') CREATE INDEX IDX_EB_INTERGRATE_TMPL_SCEID ON T_EB_INTERGRATION ( FTEMPLATEID ,FSCENEID );


 EXEC P_ALTERPK 'PK_T_EB_MERGECONTROLENTITY', 'T_EB_MERGECONTROLENTITY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_MERGECONTROLENTITY') CREATE INDEX IDX_EB_MERGECONTROLENTITY ON T_EB_MERGECONTROLENTITY ( FMODELID ,FYEARID ,FPERIODID ,FSCENARIOID ,FORGID );


 EXEC P_ALTERPK 'PK_T_EB_MERGEDATASET', 'T_EB_MERGEDATASET', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_MERGEDSET_MODEL') CREATE INDEX IDX_EB_MERGEDSET_MODEL ON T_EB_MERGEDATASET ( FMODELID ,FYEARID ,FPERIODID ,FSCENARIOID );


 EXEC P_ALTERPK 'PK_T_EB_NOFINANCIALFILE', 'T_EB_NOFINANCIALFILE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_NOFIN_TEMP') CREATE INDEX IDX_EB_NOFIN_TEMP ON T_EB_NOFINANCIALFILE ( FTEMPLATE );


 EXEC P_ALTERPK 'PK_T_EB_NOFINANCIALFILE_L', 'T_EB_NOFINANCIALFILE_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_NOFINANCIALFILE_FID') CREATE INDEX IDX_EB_NOFINANCIALFILE_FID ON T_EB_NOFINANCIALFILE_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_EB_PAGEDIMSELECT', 'T_EB_PAGEDIMSELECT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TEMPLATE') CREATE INDEX IDX_EB_TEMPLATE ON T_EB_PAGEDIMSELECT ( FTEMPLATE );


 EXEC P_ALTERPK 'PK_T_EB_PERIODMANAGEENTITY', 'T_EB_PERIODMANAGEENTITY', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_PERIODMANAGEENT') CREATE INDEX IDX_EB_PERIODMANAGEENT ON T_EB_PERIODMANAGEENTITY ( FMODELID ,FYEARID ,FPERIODID ,FSCENARIOID ,FORGID );


 EXEC P_ALTERPK 'PK_T_EB_RDATA_CUSTSET', 'T_EB_RDATA_CUSTSET', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_RDATA_CUSTSET_MODEL') CREATE INDEX IDX_EB_RDATA_CUSTSET_MODEL ON T_EB_RDATA_CUSTSET ( FMODELID );


 EXEC P_ALTERPK 'PK_T_EB_RDATA_DETAIL', 'T_EB_RDATA_DETAIL', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_RDATA_DETAIL_FID') CREATE INDEX IDX_EB_RDATA_DETAIL_FID ON T_EB_RDATA_DETAIL ( FID );


 EXEC P_ALTERPK 'PK_T_EB_REPORT', 'T_EB_REPORT', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_RPT_DIMCOMBIE') CREATE INDEX IDX_EB_RPT_DIMCOMBIE ON T_EB_REPORT ( FMODELID ,FFYID ,FPERIODID ,FCURRENCYID ,FENTITYID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_RPT_TMPLID') CREATE INDEX IDX_EB_RPT_TMPLID ON T_EB_REPORT ( FTEMPLATEID );


 EXEC P_ALTERPK 'PK_T_EB_REPORTLIST', 'T_EB_REPORTLIST', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_EB_REPORTLIST_GP') CREATE INDEX IDX_T_EB_REPORTLIST_GP ON T_EB_REPORTLIST ( FGROUPID ,FSTATUS );


 EXEC P_ALTERPK 'PK_T_EB_STATUS', 'T_EB_STATUS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_STATUS_SYPC') CREATE INDEX IDX_EB_STATUS_SYPC ON T_EB_STATUS ( FSCENARIO ,FYEAR ,FPERIOD ,FCURRENCY ,FORG );


 EXEC P_ALTERPK 'PK_T_EB_TASKCONF', 'T_EB_TASKCONF', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TASKCONF') CREATE  CLUSTERED INDEX IDX_EB_TASKCONF ON T_EB_TASKCONF ( FTASKCATALOGID );


 EXEC P_ALTERPK 'PK_T_EB_TASKCONF_L', 'T_EB_TASKCONF_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TASKCON_L') CREATE INDEX IDX_EB_TASKCON_L ON T_EB_TASKCONF_L ( FID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_EB_TASKDISPTEM', 'T_EB_TASKDISPTEM', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TASKTEM') CREATE INDEX IDX_EB_TASKTEM ON T_EB_TASKDISPTEM ( FTEMPLATEID );


 EXEC P_ALTERPK 'PK_T_EB_TASKFORPRE', 'T_EB_TASKFORPRE', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_EBTASKPRE') CREATE INDEX IDX_EB_EBTASKPRE ON T_EB_TASKFORPRE ( FTASKCONFID );


 EXEC P_ALTERPK 'PK_T_EB_TASKPARAM', 'T_EB_TASKPARAM', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TASKPARAM') CREATE INDEX IDX_EB_TASKPARAM ON T_EB_TASKPARAM ( FTASKCATALOGID );


 EXEC P_ALTERPK 'PK_T_EB_TASKSTATUS', 'T_EB_TASKSTATUS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TASK_REPORT') CREATE INDEX IDX_EB_TASK_REPORT ON T_EB_TASKSTATUS ( FREPORTTASKID ,FTEMPLATEID ,FTASKTYPE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TASK_ROOT') CREATE INDEX IDX_EB_TASK_ROOT ON T_EB_TASKSTATUS ( FROOTID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TASK_DIM') CREATE INDEX IDX_EB_TASK_DIM ON T_EB_TASKSTATUS ( FMODELID ,FFYID ,FPERIODID ,FENTITYID ,FTEMPLATEID );


 EXEC P_ALTERPK 'PK_T_EB_TMPLCOLDIM', 'T_EB_TMPLCOLDIM', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TMPLCOL_ID') CREATE INDEX IDX_EB_TMPLCOL_ID ON T_EB_TMPLCOLDIM ( FENTRYID );


 EXEC P_ALTERPK 'PK_T_EB_TMPLCOLDIM_L', 'T_EB_TMPLCOLDIM_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_EB_TMPLCOLDIM_L_FID') CREATE INDEX IDX_T_EB_TMPLCOLDIM_L_FID ON T_EB_TMPLCOLDIM_L ( FDETAILID ,FLOCALEID );


 EXEC P_ALTERPK 'PK_T_EB_TMPLDIMPOSITION', 'T_EB_TMPLDIMPOSITION', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_EBTMPLPOSITION_ID') CREATE INDEX IDX_EB_EBTMPLPOSITION_ID ON T_EB_TMPLDIMPOSITION ( FID );


 EXEC P_ALTERPK 'PK_T_EB_TMPLPAGEDIM', 'T_EB_TMPLPAGEDIM', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TMPLPAGE_TEMPLATEID') CREATE INDEX IDX_EB_TMPLPAGE_TEMPLATEID ON T_EB_TMPLPAGEDIM ( FID );


 EXEC P_ALTERPK 'PK_T_EB_TMPLPAGEDIMPROP', 'T_EB_TMPLPAGEDIMPROP', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_EBTMPLPROP_TID') CREATE INDEX IDX_EB_EBTMPLPROP_TID ON T_EB_TMPLPAGEDIMPROP ( FID );


 EXEC P_ALTERPK 'PK_T_EB_TMPLROWDIM', 'T_EB_TMPLROWDIM', 'FDETAILID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TMPLROW_ID') CREATE INDEX IDX_EB_TMPLROW_ID ON T_EB_TMPLROWDIM ( FENTRYID );


 EXEC P_ALTERPK 'PK_T_EB_TMPLVIEWPOINTDIM', 'T_EB_TMPLVIEWPOINTDIM', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TMPLVIEW_TEMPLATEID') CREATE INDEX IDX_EB_TMPLVIEW_TEMPLATEID ON T_EB_TMPLVIEWPOINTDIM ( FID );


 EXEC P_ALTERPK 'PK_T_EB_UDCFROWCOLMEMB', 'T_EB_UDCFROWCOLMEMB', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_UDCFROWCOLMEMB') CREATE INDEX IDX_EB_UDCFROWCOLMEMB ON T_EB_UDCFROWCOLMEMB ( FID );


 EXEC P_ALTERPK 'PK_T_EB_UPDATERECORD', 'T_EB_UPDATERECORD', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX__EB_UPDATERECORD') CREATE INDEX IDX__EB_UPDATERECORD ON T_EB_UPDATERECORD ( FSIGN );


 EXEC P_ALTERPK 'PK_T_EB_USERDEFCVTFORMULA', 'T_EB_USERDEFCVTFORMULA', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_USERDEFCVTF_MODEL') CREATE INDEX IDX_EB_USERDEFCVTF_MODEL ON T_EB_USERDEFCVTFORMULA ( FMODELID ,FSCENARIOID ,FTEMPLATEID );


 EXEC P_ALTERPK 'PK_T_EB_DATASOURCE', 'T_EB_DATASOURCE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_DATASOURCE_IP') CREATE INDEX IDX_EB_DATASOURCE_IP ON T_EB_DATASOURCE ( FSERVERADDRESS );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_DATASOURCE_QUOTE') CREATE INDEX IDX_EB_DATASOURCE_QUOTE ON T_EB_DATASOURCE ( FQUOTE );



/**End D:\PDM_UPGRADE\PDM1\EB_constraint.sql **/
