/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYS_constraint.sql **/
 EXEC P_ALTERPK 'PK_T_WARN_EARLYWARN', 'T_WARN_EARLYWARN', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_WARN_EARLYWARN_FNUMBER') CREATE UNIQUE INDEX IDX_WARN_EARLYWARN_FNUMBER ON T_WARN_EARLYWARN ( FNUMBER );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_WARN_EARLYWARN_FMASTERID') CREATE INDEX IDX_WARN_EARLYWARN_FMASTERID ON T_WARN_EARLYWARN ( FMASTERID );


 EXEC P_ALTERPK 'PK_T_WARN_EARLYWARN_L', 'T_WARN_EARLYWARN_L', 'FPKID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_WARN_EARLYWARN_FID') CREATE UNIQUE  CLUSTERED INDEX IDX_WARN_EARLYWARN_FID ON T_WARN_EARLYWARN_L ( FID ,FLOCALEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_WARN_EARLYWARN_NAME') CREATE INDEX IDX_WARN_EARLYWARN_NAME ON T_WARN_EARLYWARN_L ( FNAME );


 EXEC P_ALTERPK 'PK_T_WARN_SCHEDULE_L', 'T_WARN_SCHEDULE_L', 'FPKID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_WARN_SCHEDULE_FID') CREATE UNIQUE  CLUSTERED INDEX IDX_WARN_SCHEDULE_FID ON T_WARN_SCHEDULE_L ( FID ,FLOCALEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_WARN_SCHEDULE_NAME') CREATE INDEX IDX_WARN_SCHEDULE_NAME ON T_WARN_SCHEDULE_L ( FNAME );


 EXEC P_ALTERPK 'PK_T_WARN_MONITOR_DETAILLOG', 'T_WARN_MONITOR_DETAILLOG', 'FENTRYID', '1';

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


 EXEC P_ALTERPK 'PK_T_WARN_MONITORLOG', 'T_WARN_MONITORLOG', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_WARN_LOG_FWARNSCHEDULEID') CREATE INDEX IDX_WARN_LOG_FWARNSCHEDULEID ON T_WARN_MONITORLOG ( FWARNSCHEDULEID );


 EXEC P_ALTERPK 'PK_T_WARN_SCHEDULE', 'T_WARN_SCHEDULE', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_WARN_SCHEDULE_FNUMBER') CREATE UNIQUE INDEX IDX_WARN_SCHEDULE_FNUMBER ON T_WARN_SCHEDULE ( FNUMBER );



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