IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_STAFFRULEENTRY') 
 CREATE TABLE T_HAOS_STAFFRULEENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FINCLUDESUB CHAR(1) DEFAULT '0' NOT NULL,
FSTAFFPROJECTID BIGINT DEFAULT 0 NOT NULL,
FREFSTAFFID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_STAFFRULEORG') 
 CREATE TABLE T_HAOS_STAFFRULEORG (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HAOS_STAFFORGEMPCOUNT') 
 CREATE TABLE T_HAOS_STAFFORGEMPCOUNT (
FID BIGINT DEFAULT 0 NOT NULL,
FUSEORGBOID BIGINT DEFAULT 0 NOT NULL,
FCOUNT INT DEFAULT 0 NOT NULL,
FCONTAINSUBCOUNT INT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);
