/**Begin D:\PDM_UPGRADE\PDM1\BCM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_TEMPLATECATALOG_L' AND KSQL_COL_NAME IN ('FFINSTRUCTION')) 
 ALTER TABLE T_BCM_TEMPLATECATALOG_L ADD (FFINSTRUCTION NVARCHAR(200) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_TEMPLATECATALOG' AND KSQL_COL_NAME IN ('FFINSTRUCTION')) 
 ALTER TABLE T_BCM_TEMPLATECATALOG ADD (FFINSTRUCTION NVARCHAR(200) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_TRANSFERMODEL_LOG') 
 CREATE TABLE T_BCM_TRANSFERMODEL_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FSOURCEMODEL BIGINT DEFAULT 0 NOT NULL,
FACTIONTYPE VARCHAR(50) DEFAULT ' ' NOT NULL,
FTARGETSHOWNUM VARCHAR(50) DEFAULT ' ' NOT NULL,
FMODELNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FACTIONSTATUS VARCHAR(50) DEFAULT ' ' NOT NULL,
FINCLUDEDATA CHAR(1) DEFAULT '0' NOT NULL,
FREQUESTPARAM VARCHAR(2000) DEFAULT ' ' NOT NULL,
FERRMSG VARCHAR(2000) DEFAULT ' ' NOT NULL,
FCOSTTIME BIGINT DEFAULT 0 NOT NULL,
FTRACEID VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_USERPREFERSET') 
 CREATE TABLE T_BCM_USERPREFERSET (
FID BIGINT DEFAULT 0 NOT NULL,
FNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FUSER BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFYDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_TRANSFERMODEL_DETAI') 
 CREATE TABLE T_BCM_TRANSFERMODEL_DETAI (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FACTLOGNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTRYNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FORIGINPK NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNEWPK NVARCHAR(50) DEFAULT ' ' NOT NULL
);



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