/** 合同签约增加分录 **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_ER_CONSIGNPARTY')
CREATE TABLE T_ER_CONSIGNPARTY (
                                   FID BIGINT DEFAULT 0 NOT NULL,
                                   FENTRYID BIGINT DEFAULT 0 NOT NULL,
                                   FSEQ INT DEFAULT 0 NOT NULL,
                                   FCONTACTPERSON NVARCHAR(100) DEFAULT ' ' NOT NULL,
                                   FSIGNTEL NVARCHAR(255) DEFAULT ' ' NOT NULL,
                                   FTAXCERTIFICATE NVARCHAR(200) DEFAULT ' ' NOT NULL,
                                   FPARTYTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FCONTRACTPARTY BIGINT DEFAULT 0 NOT NULL,
                                   FSIGNCONTRACT VARCHAR(50) DEFAULT ' ' NOT NULL,
                                   FPARTPERSON VARCHAR(80) DEFAULT ' ' NOT NULL,
                                   FPARTYSRCENTRYID BIGINT DEFAULT 0 NOT NULL
);

EXEC P_ALTERPK 'PK_T_ER_CONSIGNPARTY', 'T_ER_CONSIGNPARTY', 'FENTRYID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_ER_SIGNCONTPARTY_SEQ') CREATE INDEX IDX_ER_SIGNCONTPARTY_SEQ ON T_ER_CONSIGNPARTY ( FID ,FSEQ );

