/**Begin D:\PDM_UPGRADE\PDM1\EB_constraint.sql **/
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_AUDIT_RPTPRO') CREATE INDEX IDX_AUDIT_RPTPRO ON T_EB_APPROVELNOTE ( FRPTENTITYID );

 EXEC P_ALTERPK 'PK_T_EB_TEMPLATEORG', 'T_EB_TEMPLATEORG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TEMPLATEORG_P1') CREATE INDEX IDX_EB_TEMPLATEORG_P1 ON T_EB_TEMPLATEORG ( FSCHEMEID );


 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IX_EB_DYNAMICREPORT_2') CREATE INDEX IX_EB_DYNAMICREPORT_2 ON T_EB_DYNAMICREPORT ( FSCHEMEASSIGNID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_REPORTATTACHMENT_P3') CREATE INDEX IDX_EB_REPORTATTACHMENT_P3 ON T_EB_REPORTATTACHMENT ( FRPTENTITYID );

 EXEC P_ALTERPK 'PK_T_EB_RPTSCHEME', 'T_EB_RPTSCHEME', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SCHEME_P1') CREATE INDEX IDX_EB_SCHEME_P1 ON T_EB_RPTSCHEME ( FBIZRANGEID );

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


 EXEC P_ALTERPK 'PK_T_EB_RPTSCHEME_L', 'T_EB_RPTSCHEME_L', 'FPKID', '1';

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


 EXEC P_ALTERPK 'PK_T_EB_SCHEMEASSIGN', 'T_EB_SCHEMEASSIGN', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SCHEMEASSIGN_P1') CREATE INDEX IDX_EB_SCHEMEASSIGN_P1 ON T_EB_SCHEMEASSIGN ( FSCHEMEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SCHEMEASSIGN_P2') CREATE INDEX IDX_EB_SCHEMEASSIGN_P2 ON T_EB_SCHEMEASSIGN ( FBIZRANGEID );


 EXEC P_ALTERPK 'PK_T_EB_TEMPLATEUSER', 'T_EB_TEMPLATEUSER', 'FID', '1';

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

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_TEMPLATEUSER_P3') CREATE INDEX IDX_EB_TEMPLATEUSER_P3 ON T_EB_TEMPLATEUSER ( FUSERID );



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