IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_TASKSAVE_BAK') 
 CREATE TABLE T_EB_TASKSAVE_BAK (
FID BIGINT DEFAULT 0 NOT NULL,
FTASKLISTID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FORGRANGE NVARCHAR(20) DEFAULT ' ' NOT NULL,
FCREATERID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FEXECUTORID BIGINT DEFAULT 0 NOT NULL,
FTASKSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FORGVIEWID BIGINT NOT NULL DEFAULT 0,
FTASKID BIGINT DEFAULT 0 NOT NULL
);
EXEC P_ALTERPK 'PK_T_EB_TASKSAVE_BAK', 'T_EB_TASKSAVE_BAK', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_TASKDISTORG_BAK') 
 CREATE TABLE T_EB_TASKDISTORG_BAK (
	FID BIGINT NOT NULL DEFAULT 0,
	FTASKID BIGINT NOT NULL DEFAULT 0,
	FORGID BIGINT NOT NULL DEFAULT 0,
	FRANGEVALUE NVARCHAR(10) DEFAULT '0' NOT NULL,
	FCREATERID BIGINT NOT NULL DEFAULT 0,
	FCREATEDATE DATETIME,
	FMODIFIER BIGINT NOT NULL DEFAULT 0,
	FMODIFYDATE DATETIME,
	FEXECUTORID BIGINT DEFAULT 0 NOT NULL,
	FTASKSTATUS CHAR(1) DEFAULT '1',
	FORGVIEWID BIGINT NOT NULL DEFAULT 0,
	FTASK BIGINT NOT NULL DEFAULT 0
);
EXEC P_ALTERPK 'PK_T_EB_TASKDISTORG_BAK', 'T_EB_TASKDISTORG_BAK', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_TASKSUPERVISOR_BAK') 
 CREATE TABLE T_EB_TASKSUPERVISOR_BAK (
	FID         BIGINT DEFAULT 0 NOT NULL,
    FENTRYID    BIGINT DEFAULT 0 NOT NULL,
    FSEQ        BIGINT DEFAULT 0 NOT NULL,
    FSUPERVISOR BIGINT DEFAULT 0 NOT NULL,
    FUSERFIELD  BIGINT DEFAULT 0 NOT NULL
);
EXEC P_ALTERPK 'PK_T_EB_TASKSUPERVISOR_BAK', 'T_EB_TASKSUPERVISOR_BAK', 'FENTRYID', '1';