/**Begin D:\PDM_UPGRADE\PDM1\LOG_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDLOG_OPTYPE') 
 CREATE TABLE T_BDLOG_OPTYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FARCHIVERETAINDAYS INT 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_BDLOG_OPTYPE_L') 
 CREATE TABLE T_BDLOG_OPTYPE_L (
FID BIGINT DEFAULT 0 NOT NULL,
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDLOG_LOG') 
 CREATE TABLE T_BDLOG_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FOPERATTYPEID BIGINT DEFAULT 0 NOT NULL,
FOPERATTYPENUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FOPERATTYPENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATSOURCE VARCHAR(30) DEFAULT ' ' NOT NULL,
FOPERATSOURCEID BIGINT DEFAULT 0 NOT NULL,
FOPERATOBJ NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATOBJNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATORGID BIGINT DEFAULT 0 NOT NULL,
FOPERATORGNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FOPERATORGNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATTIME DATETIME,
FOPERATORID BIGINT DEFAULT 0 NOT NULL,
FOPERATORNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATORNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FOPERATINSTRUCTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCLIENTTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FCLIENTIP VARCHAR(128) DEFAULT ' ' NOT NULL,
FARCHIVETIME DATETIME,
FFROMBACKUP CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDLOG_DATAENTRY') 
 CREATE TABLE T_BDLOG_DATAENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FDATAENTRYID BIGINT DEFAULT 0 NOT NULL,
FDATANUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FDATANAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FCREATEORGNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATEORGNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNEWCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FNEWCREATEORGNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNEWCREATEORGNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCTRLSTRATEGY VARCHAR(30) DEFAULT ' ' NOT NULL,
FDATASTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FFAILURECAUSE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDLOG_ORGENTRY') 
 CREATE TABLE T_BDLOG_ORGENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FORGENTRYID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FORGNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FORGNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORGSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FDETAILS NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDLOG_FAILCAUSEDETAIL') 
 CREATE TABLE T_BDLOG_FAILCAUSEDETAIL (
FORGENTRYID BIGINT DEFAULT 0 NOT NULL,
FFAILDETAILID BIGINT DEFAULT 0 NOT NULL,
FFAILDATANUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FFAILDATANAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFAILCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FFAILCREATEORGNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FFAILCREATEORGNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FORGFAILURECAUSE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDLOG_ARCHIVELOG') 
 CREATE TABLE T_BDLOG_ARCHIVELOG (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FOPERATTYPEID BIGINT DEFAULT 0 NOT NULL,
FOPERATTYPENUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FOPERATTYPENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATSOURCE VARCHAR(30) DEFAULT ' ' NOT NULL,
FOPERATSOURCEID BIGINT DEFAULT 0 NOT NULL,
FOPERATOBJ NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATOBJNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATORGID BIGINT DEFAULT 0 NOT NULL,
FOPERATORGNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FOPERATORGNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATTIME DATETIME,
FOPERATORID BIGINT DEFAULT 0 NOT NULL,
FOPERATORNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOPERATORNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FOPERATINSTRUCTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCLIENTTYPE VARCHAR(30) DEFAULT ' ' NOT NULL,
FCLIENTIP VARCHAR(128) DEFAULT ' ' NOT NULL,
FARCHIVETIME DATETIME,
FFROMBACKUP CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDLOG_ARCHIVEDATAENTRY') 
 CREATE TABLE T_BDLOG_ARCHIVEDATAENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FDATAENTRYID BIGINT DEFAULT 0 NOT NULL,
FDATANUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FDATANAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FCREATEORGNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATEORGNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNEWCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FNEWCREATEORGNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNEWCREATEORGNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FCTRLSTRATEGY VARCHAR(30) DEFAULT ' ' NOT NULL,
FDATASTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FFAILURECAUSE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDLOG_ARCHIVEORGENTRY') 
 CREATE TABLE T_BDLOG_ARCHIVEORGENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FORGENTRYID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FORGNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FORGNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORGSTATUS VARCHAR(30) DEFAULT ' ' NOT NULL,
FDETAILS NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BDLOG_ARCHIVEFAILDETAIL') 
 CREATE TABLE T_BDLOG_ARCHIVEFAILDETAIL (
FORGENTRYID BIGINT DEFAULT 0 NOT NULL,
FFAILDETAILID BIGINT DEFAULT 0 NOT NULL,
FFAILDATANUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FFAILDATANAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FFAILCREATEORGID BIGINT DEFAULT 0 NOT NULL,
FFAILCREATEORGNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FFAILCREATEORGNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FORGFAILURECAUSE NVARCHAR(255) DEFAULT ' ' NOT NULL
);



/**End D:\PDM_UPGRADE\PDM1\LOG_table.sql **/
