
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_APPROVEBILL' AND KSQL_COL_NAME IN ('FAPPROVETYPEID'))
ALTER TABLE T_EB_APPROVEBILL ADD (FAPPROVETYPEID BIGINT NOT NULL DEFAULT 0);

/*==============================================================*/
/* Table: T_EB_APPROVEBAILORG      审批单委托行政组织表         */
/*==============================================================*/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_APPROVEBAILORG')
CREATE TABLE T_EB_APPROVEBAILORG (
   FPKID             	BIGINT               NOT NULL DEFAULT 0,
   FID                  BIGINT               NOT NULL DEFAULT 0,
   FBASEDATAID          BIGINT               NOT NULL DEFAULT 0
);

 EXEC P_ALTERPK 'PK_EB_APPROVEBAILORG', 'T_EB_APPROVEBAILORG', 'FPKID', '1';
 
/*==============================================================*/
/* Index: IDX_EB_APPROVEBAILORG                                 */
/*==============================================================*/
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_APPROVEBAILORG')
CREATE INDEX IDX_EB_APPROVEBAILORG ON T_EB_APPROVEBAILORG ( FID );
