/**Begin D:\PDM_UPGRADE\PDM1\HPDI_constraint.sql **/
 EXEC P_ALTERPK 'PK_HPDI_SSCTASK', 'T_HPDI_SSCTASK', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASK' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASK_FSSCID') CREATE INDEX IDX_HPDI_SSCTASK_FSSCID ON T_HPDI_SSCTASK ( FSSCID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASK' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASK_FPSONID') CREATE INDEX IDX_HPDI_SSCTASK_FPSONID ON T_HPDI_SSCTASK ( FPERSONID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASK' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASK_FBTYPEID') CREATE INDEX IDX_HPDI_SSCTASK_FBTYPEID ON T_HPDI_SSCTASK ( FBILLTYPEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASK' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASK_FTTYPEID') CREATE INDEX IDX_HPDI_SSCTASK_FTTYPEID ON T_HPDI_SSCTASK ( FTASKTYPEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASK' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASK_FBLONGID') CREATE INDEX IDX_HPDI_SSCTASK_FBLONGID ON T_HPDI_SSCTASK ( FBILLLONGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASK' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASK_FCTIME') CREATE INDEX IDX_HPDI_SSCTASK_FCTIME ON T_HPDI_SSCTASK ( FCREATETIME );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASK' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASK_FRTIME') CREATE INDEX IDX_HPDI_SSCTASK_FRTIME ON T_HPDI_SSCTASK ( FRECEIVETIME );


 EXEC P_ALTERPK 'PK_HPDI_SSCTASK_Q', 'T_HPDI_SSCTASK_Q', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASK_Q' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASK_Q_FOPID') CREATE INDEX IDX_HPDI_SSCTASK_Q_FOPID ON T_HPDI_SSCTASK_Q ( FOPERATORID );


 EXEC P_ALTERPK 'PK_HPDI_SSCTASKHIS', 'T_HPDI_SSCTASKHIS', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASKHIS' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASKHIS_FSSCID') CREATE INDEX IDX_HPDI_SSCTASKHIS_FSSCID ON T_HPDI_SSCTASKHIS ( FSSCID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASKHIS' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASKHIS_FPSONID') CREATE INDEX IDX_HPDI_SSCTASKHIS_FPSONID ON T_HPDI_SSCTASKHIS ( FPERSONID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASKHIS' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASKHIS_FBTYPEID') CREATE INDEX IDX_HPDI_SSCTASKHIS_FBTYPEID ON T_HPDI_SSCTASKHIS ( FBILLTYPEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASKHIS' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASKHIS_FTTYPEID') CREATE INDEX IDX_HPDI_SSCTASKHIS_FTTYPEID ON T_HPDI_SSCTASKHIS ( FTASKTYPEID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASKHIS' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASKHIS_FBLONGID') CREATE INDEX IDX_HPDI_SSCTASKHIS_FBLONGID ON T_HPDI_SSCTASKHIS ( FBILLLONGID );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASKHIS' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASKHIS_FCTIME') CREATE INDEX IDX_HPDI_SSCTASKHIS_FCTIME ON T_HPDI_SSCTASKHIS ( FCREATETIME );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASKHIS' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASKHIS_FRTIME') CREATE INDEX IDX_HPDI_SSCTASKHIS_FRTIME ON T_HPDI_SSCTASKHIS ( FRECEIVETIME );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASKHIS' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASKHIS_FSTASKID') CREATE INDEX IDX_HPDI_SSCTASKHIS_FSTASKID ON T_HPDI_SSCTASKHIS ( FSOURCETASKID );


 EXEC P_ALTERPK 'PK_HPDI_SSCTASKHIS_Q', 'T_HPDI_SSCTASKHIS_Q', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_TABNAME = 'T_HPDI_SSCTASKHIS_Q' AND KSQL_INDNAME = 'IDX_HPDI_SSCTASKHIS_Q_FOPID') CREATE INDEX IDX_HPDI_SSCTASKHIS_Q_FOPID ON T_HPDI_SSCTASKHIS_Q ( FOPERATORID );



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