/**Begin D:\DBA\1.4\PDM_UPGRADE\PDM1\BCM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_SCHEMECATALOG' AND KSQL_COL_NAME ='FTYPE') 
 ALTER TABLE T_BCM_SCHEMECATALOG ADD (FTYPE CHAR(2) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISIMPORTMODE' AND KSQL_COL_NAME ='FOTHERDIM') 
 ALTER TABLE T_BCM_ISIMPORTMODE ADD (FOTHERDIM VARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISIMPORTMODE' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BCM_ISIMPORTMODE ADD (FNAME VARCHAR(200) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISIMPORTMODE' AND KSQL_COL_NAME ='FNUMBER') 
 ALTER TABLE T_BCM_ISIMPORTMODE ADD (FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISCLEARDATACONFIG' AND KSQL_COL_NAME ='FIMPORTMODEID') 
 ALTER TABLE T_BCM_ISCLEARDATACONFIG ADD (FIMPORTMODEID BIGINT DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_SCHEMECOLLECTLOG' AND KSQL_COL_NAME ='FSCHEMEPARAM') 
 ALTER TABLE T_BCM_SCHEMECOLLECTLOG ADD (FSCHEMEPARAM VARCHAR(500) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_SCHEMECOLLECTLOG' AND KSQL_COL_NAME ='FLOGSOURCE') 
 ALTER TABLE T_BCM_SCHEMECOLLECTLOG ADD (FLOGSOURCE VARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISSCHEME_A') 
 CREATE TABLE T_BCM_ISSCHEME_A (
FID BIGINT DEFAULT 0 NOT NULL,
FSOURCESYSID BIGINT DEFAULT 0 NOT NULL,
FSOURCEOBJID BIGINT DEFAULT 0 NOT NULL,
FTARGETSYSID BIGINT DEFAULT 0 NOT NULL,
FTARGETOBJID BIGINT DEFAULT 0 NOT NULL,
FMETRICTYPE CHAR(1) DEFAULT '1' NOT NULL,
FSINGLEMETRIC VARCHAR(50) DEFAULT ' ' NOT NULL,
FISCDATACOPYID BIGINT DEFAULT 0 NOT NULL,
FISCDATACOPYTRIGGERID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_DI_SCHEMEPARAM') 
 CREATE TABLE T_DI_SCHEMEPARAM (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPARAMNAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FSRCPARAMNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FDEFAULTVALUE VARCHAR(50) DEFAULT ' ' NOT NULL,
FCANBENULL CHAR(1) DEFAULT '0' NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '1' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_DI_SCHEMEPARAM_L') 
 CREATE TABLE T_DI_SCHEMEPARAM_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPARAMNAME NVARCHAR(200) DEFAULT ' ' NOT NULL
);



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