/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BCM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ADJUSTTEMPLATE_L') 
 CREATE TABLE T_BCM_ADJUSTTEMPLATE_L (
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_APPROVALAUTHORITY_L' AND KSQL_COL_NAME ='FUSERNAME') 
 ALTER TABLE T_BCM_APPROVALAUTHORITY_L ADD (FUSERNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_APPROVALAUTHORITY_L' AND KSQL_COL_NAME ='FAPPROVALSTAGE') 
 ALTER TABLE T_BCM_APPROVALAUTHORITY_L ADD (FAPPROVALSTAGE NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_PHASESUBMITCASE' AND KSQL_COL_NAME ='FMODIFIER') 
 ALTER TABLE T_BCM_PHASESUBMITCASE ADD (FMODIFIER BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_PHASESUBMITCASE' AND KSQL_COL_NAME ='FMODIFYDATE') 
 ALTER TABLE T_BCM_PHASESUBMITCASE ADD (FMODIFYDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_BATCHCHILDCONFIGSET') 
 CREATE TABLE T_BCM_BATCHCHILDCONFIGSET (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ SMALLINT DEFAULT 0 NOT NULL,
FISSHOW CHAR(1) DEFAULT '0' NOT NULL,
FCHILDNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_BATCHCONFIGSETTING') 
 CREATE TABLE T_BCM_BATCHCONFIGSETTING (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FDESCRIPTION NVARCHAR(300) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_BATCHCONFIGSETTING_L') 
 CREATE TABLE T_BCM_BATCHCONFIGSETTING_L (
FPKID VARCHAR(50) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(300) DEFAULT ' ' NOT NULL
);



/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BCM_table.sql **/
