/**Begin D:\DBA\PDM_UPGRADE\PDM1\BCM_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_BATCHEXPORTRPT' AND KSQL_COL_NAME IN ('FDEFINEDNUMBER')) 
 ALTER TABLE T_BCM_BATCHEXPORTRPT ADD (FDEFINEDNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_BATCHEXPORTRPT' AND KSQL_COL_NAME IN ('FDEFINEDNAME')) 
 ALTER TABLE T_BCM_BATCHEXPORTRPT ADD (FDEFINEDNAME NVARCHAR(500) DEFAULT ' ' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_DATACOLLECT' AND KSQL_COL_NAME IN ('FGROUPID')) 
 ALTER TABLE T_BCM_DATACOLLECT ADD (FGROUPID BIGINT DEFAULT 0 NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_BATCHEXPORTRPT_L') 
 CREATE TABLE T_BCM_BATCHEXPORTRPT_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FDEFINEDNAME NVARCHAR(500) DEFAULT ' ' NOT NULL
);


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