/**Begin D:\pdm\PDM_UPGRADE\pdm1\SIM_constraint.sql **/
 EXEC P_ALTERPK 'PK_SIM_INV_APPLY', 'T_SIM_INV_APPLY', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SIM_INV_APPLY') CREATE  CLUSTERED INDEX IDX_SIM_INV_APPLY ON T_SIM_INV_APPLY ( FEPINFO );


 EXEC P_ALTERPK 'PK_SIM_INV_APPLY_LOG', 'T_SIM_INV_APPLY_LOG', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SIM_INV_APPLY_LOG') CREATE  CLUSTERED INDEX IDX_SIM_INV_APPLY_LOG ON T_SIM_INV_APPLY_LOG ( FEQINFO );


 EXEC P_ALTERPK 'PK_SIM_INV_APPLY_DETAIL', 'T_SIM_INV_APPLY_DETAIL', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SIM_INV_APPLY_DETAIL') CREATE  CLUSTERED INDEX IDX_SIM_INV_APPLY_DETAIL ON T_SIM_INV_APPLY_DETAIL ( FEPINFO ,FINVOICETYPE );


 EXEC P_ALTERPK 'PK_SIM_VATINVOICE_ITEM', 'T_SIM_VATINVOICE_ITEM', 'FENTRYID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SIM_VATINVOICE_ITEM_FK') CREATE  CLUSTERED INDEX IDX_SIM_VATINVOICE_ITEM_FK ON T_SIM_VATINVOICE_ITEM ( FID );


 EXEC P_ALTERPK 'PK_SIM_DRAWER_SETTING', 'T_SIM_DRAWER_SETTING', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SIM_DRAWER_SETTING') CREATE  CLUSTERED INDEX IDX_SIM_DRAWER_SETTING ON T_SIM_DRAWER_SETTING ( FTAXNO );


 EXEC P_ALTERPK 'PK_SIM_INVOICE_SUM_DATA', 'T_SIM_INVOICE_SUM_DATA', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SIM_INVOICE_SUM_DATA') CREATE  CLUSTERED INDEX IDX_SIM_INVOICE_SUM_DATA ON T_SIM_INVOICE_SUM_DATA ( FORGFIELD );


 EXEC P_ALTERPK 'PK_SIM_INVOICE_SETTING', 'T_SIM_INVOICE_SETTING', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SIM_INVOICE_SETTING') CREATE  CLUSTERED INDEX IDX_SIM_INVOICE_SETTING ON T_SIM_INVOICE_SETTING ( FTAXNO );


 EXEC P_ALTERPK 'PK_SIM_VATINVOICE', 'T_SIM_VATINVOICE', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SIM_VATINVOICE') CREATE  CLUSTERED INDEX IDX_SIM_VATINVOICE ON T_SIM_VATINVOICE ( FINVOICECODE ,FINVOICENO );


 EXEC P_ALTERPK 'PK_SIM_VATINVOICE_E', 'T_SIM_VATINVOICE_E', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SIM_VATINVOICE_E_FK') CREATE  CLUSTERED INDEX IDX_SIM_VATINVOICE_E_FK ON T_SIM_VATINVOICE_E ( FCONTRASTSTATUS );


 EXEC P_ALTERPK 'PK_SIM_RED_INFO', 'T_SIM_RED_INFO', 'FID', '0';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SIM_RED_INFO_CODE') CREATE UNIQUE  CLUSTERED INDEX IDX_SIM_RED_INFO_CODE ON T_SIM_RED_INFO ( FINFOCODE );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SIM_RED_INFO_TIME') CREATE INDEX IDX_SIM_RED_INFO_TIME ON T_SIM_RED_INFO ( FCREATETIME );


 EXEC P_ALTERPK 'PK_SIM_RED_INFO_ITEM', 'T_SIM_RED_INFO_ITEM', 'FENTRYID', '0';

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

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_SIM_RED_INFO_NO') CREATE  CLUSTERED INDEX IDX_SIM_RED_INFO_NO ON T_SIM_RED_INFO_ITEM ( FSEQ );



/**End D:\pdm\PDM_UPGRADE\pdm1\SIM_constraint.sql **/
