IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_ORGCHECKERREGISTER') 
 CREATE TABLE T_PBD_ORGCHECKERREGISTER (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FENTITYID VARCHAR(36) DEFAULT ' ' NOT NULL,
FORGFIELD VARCHAR(120) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT '0' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FPRESET CHAR(1) DEFAULT '0' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PBD_ORGCHECKERREGISTER_L') 
 CREATE TABLE T_PBD_ORGCHECKERREGISTER_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMSG NVARCHAR(512) DEFAULT ' ' NOT NULL
);


 EXEC P_ALTERPK 'PK_PBD_ORGCHECKERREGISTER', 'T_PBD_ORGCHECKERREGISTER', 'FID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PBD_ORGCR_FNUMBER') CREATE UNIQUE INDEX IDX_PBD_ORGCR_FNUMBER ON T_PBD_ORGCHECKERREGISTER ( FNUMBER );

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PBD_ORGCR_FENTITYID') CREATE INDEX IDX_PBD_ORGCR_FENTITYID ON T_PBD_ORGCHECKERREGISTER ( FENTITYID );


 EXEC P_ALTERPK 'PK_PBD_ORGCHECKERREGISTER_L', 'T_PBD_ORGCHECKERREGISTER_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PBD_ORGCR_L_FID') CREATE INDEX IDX_PBD_ORGCR_L_FID ON T_PBD_ORGCHECKERREGISTER_L ( FID ,FLOCALEID );