/**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_CURRENCYRECORD') 
 CREATE TABLE T_BCM_CURRENCYRECORD (
FID BIGINT DEFAULT 0 NOT NULL,
FENTITYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FCURRENCYEFFDATE DATETIME,
FCURRENCYEXPDATE DATETIME,
FCURRENCYMODIFIER BIGINT DEFAULT 0 NOT NULL,
FCURRENCYMODIFYTIME DATETIME,
FCURRENCYRDS BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_USERDEFCVTFORMULA' AND KSQL_COL_NAME ='FCVTFORMULAECHOED') 
 ALTER TABLE T_BCM_USERDEFCVTFORMULA ADD (FCVTFORMULAECHOED VARCHAR(1000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_AGGSHIELDRULE') 
 CREATE TABLE T_BCM_AGGSHIELDRULE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FRULE VARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_CONFIGSETTING' AND KSQL_COL_NAME ='FISENABLE') 
 ALTER TABLE T_BCM_CONFIGSETTING ADD (FISENABLE CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_AGGSHIELDRULEDIS') 
 CREATE TABLE T_BCM_AGGSHIELDRULEDIS (
FID BIGINT DEFAULT 0 NOT NULL,
FMEMBERID BIGINT DEFAULT 0 NOT NULL,
FRULEID BIGINT DEFAULT 0 NOT NULL
);



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