/*添加主键*/
EXEC P_ALTERPK 'PK_T_ER_INVOICEANDEXPENSE', 'T_ER_INVOICEANDEXPENSE', 'FENTRYID', '1';

/*添加索引*/
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IE_FEXPENSEENTRYID') CREATE INDEX IDX_IE_FEXPENSEENTRYID ON T_ER_INVOICEANDEXPENSE ( FEXPENSEENTRYID );

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_IE_FINVOICEENTRYID') CREATE INDEX IDX_IE_FINVOICEENTRYID ON T_ER_INVOICEANDEXPENSE ( FINVOICEENTRYID );

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