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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_EB_USER_MODEL') CREATE INDEX IDX_T_EB_USER_MODEL ON T_EB_ANALYSEREPORT_USER ( FMODELID ,FISREAD );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_EB_USER_REPORT') CREATE INDEX IDX_T_EB_USER_REPORT ON T_EB_ANALYSEREPORT_USER ( FREPORTID );


 EXEC P_ALTERPK 'PK_T_EB_ANALYSEREPORT', 'T_EB_ANALYSEREPORT', 'FID', '1';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_EB_REPORT_TEMPID') CREATE INDEX IDX_T_EB_REPORT_TEMPID ON T_EB_ANALYSEREPORT ( FRPTTEMPID );


 EXEC P_ALTERPK 'PK_T_EB_ANALYSERPTTEMPLATE', 'T_EB_ANALYSERPTTEMPLATE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_EB_RPTTEMP_MODEL') CREATE INDEX IDX_T_EB_RPTTEMP_MODEL ON T_EB_ANALYSERPTTEMPLATE ( FMODELID ,FBIZMODELID );


 EXEC P_ALTERPK 'PK_T_EB_ANALYSERPTTEMPLATE_L', 'T_EB_ANALYSERPTTEMPLATE_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_EB_ANALYSEVARSEL', 'T_EB_ANALYSEVARSEL', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_EB_ALYVARSEL_FTMPID') CREATE  CLUSTERED INDEX IDX_T_EB_ALYVARSEL_FTMPID ON T_EB_ANALYSEVARSEL ( FRPTTEMPID );


 EXEC P_ALTERPK 'PK_T_EB_DIMCOMBINATION', 'T_EB_DIMCOMBINATION', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_EB_DIMCOM_MODEL') CREATE INDEX IDX_T_EB_DIMCOM_MODEL ON T_EB_DIMCOMBINATION ( FMODELID ,FBIZMODELID );


 EXEC P_ALTERPK 'PK_T_EB_DIMPARAMETER', 'T_EB_DIMPARAMETER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_EB_DIMPARAM_MODEL') CREATE INDEX IDX_T_EB_DIMPARAM_MODEL ON T_EB_DIMPARAMETER ( FMODELID ,FBIZMODELID );


 EXEC P_ALTERPK 'PK_T_EB_JUDGECONDITION', 'T_EB_JUDGECONDITION', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_EB_JUDGE_MODEL') CREATE INDEX IDX_T_EB_JUDGE_MODEL ON T_EB_JUDGECONDITION ( FMODELID ,FBIZMODELID );


 EXEC P_ALTERPK 'PK_T_EB_JUDGECONDITIONENTRY', 'T_EB_JUDGECONDITIONENTRY', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_EB_REPORTVARIABLETYPE', 'T_EB_REPORTVARIABLETYPE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_T_EB_VARTYPE_MODEL') CREATE INDEX IDX_T_EB_VARTYPE_MODEL ON T_EB_REPORTVARIABLETYPE ( FMODELID ,FBIZMODELID );


 EXEC P_ALTERPK 'PK_T_EB_RPTSHARESCHEME', 'T_EB_RPTSHARESCHEME', 'FID', '1';

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


 EXEC P_ALTERPK 'PK_T_EB_RPTSHARESCHEME_USER', 'T_EB_RPTSHARESCHEME_USER', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_EB_RPTTEMPLATE_USER', 'T_EB_RPTTEMPLATE_USER', 'FPKID', '1';

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



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