/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYSEXT_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_KS_SCRIPTLET_GROUP_L', 'T_KS_SCRIPTLET_GROUP_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KS_SCRIPTLET_GROUP_L' AND KSQL_INDNAME = 'IDX_KS_ST_GROUP_L_FID') CREATE INDEX IDX_KS_ST_GROUP_L_FID ON T_KS_SCRIPTLET_GROUP_L ( FID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KS_SCRIPTLET_GROUP_L' AND KSQL_INDNAME = 'IDX_KS_ST_GROUP_L_FNAME') CREATE INDEX IDX_KS_ST_GROUP_L_FNAME ON T_KS_SCRIPTLET_GROUP_L ( FNAME );


 EXEC P_ALTERPK 'PK_T_KS_SCRIPTLET_L', 'T_KS_SCRIPTLET_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KS_SCRIPTLET_L' AND KSQL_INDNAME = 'IDX_KS_ST_L_FID') CREATE INDEX IDX_KS_ST_L_FID ON T_KS_SCRIPTLET_L ( FID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KS_SCRIPTLET_L' AND KSQL_INDNAME = 'IDX_KS_ST_L_FNAME') CREATE INDEX IDX_KS_ST_L_FNAME ON T_KS_SCRIPTLET_L ( FNAME );


 EXEC P_ALTERPK 'PK_T_KS_CONTROL', 'T_KS_CONTROL', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KS_CONTROL' AND KSQL_INDNAME = 'IDX_KS_CONTROL_FBILL') CREATE INDEX IDX_KS_CONTROL_FBILL ON T_KS_CONTROL ( FBILLNO );


 EXEC P_ALTERPK 'PK_T_KS_CONTROL_SCRIPT', 'T_KS_CONTROL_SCRIPT', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KS_CONTROL_SCRIPT' AND KSQL_INDNAME = 'IDX_KS_CONTROL_SCRIPT_FID') CREATE INDEX IDX_KS_CONTROL_SCRIPT_FID ON T_KS_CONTROL_SCRIPT ( FID );


 EXEC P_ALTERPK 'PK_T_KS_MONITOR', 'T_KS_MONITOR', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KS_MONITOR' AND KSQL_INDNAME = 'IDX_KS_MONITOR_BILLNO') CREATE INDEX IDX_KS_MONITOR_BILLNO ON T_KS_MONITOR ( FBILLNO );


 EXEC P_ALTERPK 'PK_T_KS_MONITOR_LOG', 'T_KS_MONITOR_LOG', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KS_MONITOR_LOG' AND KSQL_INDNAME = 'IDX_KS_MONITOR_LOG_FID') CREATE INDEX IDX_KS_MONITOR_LOG_FID ON T_KS_MONITOR_LOG ( FID );


 EXEC P_ALTERPK 'PK_T_KS_SCRIPTLET', 'T_KS_SCRIPTLET', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KS_SCRIPTLET' AND KSQL_INDNAME = 'IDX_KS_SCRIPTLET_NUMBER') CREATE INDEX IDX_KS_SCRIPTLET_NUMBER ON T_KS_SCRIPTLET ( FNUMBER );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KS_SCRIPTLET' AND KSQL_INDNAME = 'IDX_KS_SCRIPTLET_NAME') CREATE INDEX IDX_KS_SCRIPTLET_NAME ON T_KS_SCRIPTLET ( FNAME );


 EXEC P_ALTERPK 'PK_T_KS_SCRIPTLET_GROUP', 'T_KS_SCRIPTLET_GROUP', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_KS_SCRIPTLET_GROUP' AND KSQL_INDNAME = 'IDX_KS_ST_GROUP_FNUMBER') CREATE INDEX IDX_KS_ST_GROUP_FNUMBER ON T_KS_SCRIPTLET_GROUP ( FNUMBER );



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYSEXT_constraint.sql **/
