/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BASE_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BD_SYNCRULESV') 
 CREATE TABLE T_BD_SYNCRULESV (
FID BIGINT DEFAULT 0 NOT NULL,
FUSERID BIGINT DEFAULT 0 NOT NULL,
FISINCREMENTSYNC CHAR(1) DEFAULT '0' NOT NULL,
FISLATESTAUDITTIME CHAR(1) DEFAULT '1' NOT NULL,
FMATFILTER NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FMATFILTER_TAG NCLOB,
FPROCESSTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSAVETYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FBOMTYPEID BIGINT DEFAULT 0 NOT NULL,
FISMAINPROCROUTE CHAR(1) DEFAULT '1' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ROUTER' AND KSQL_COL_NAME ='FSYNCTIME') 
 ALTER TABLE T_BD_ROUTER ADD (FSYNCTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_COSTBOM' AND KSQL_COL_NAME ='FSYNCTIME') 
 ALTER TABLE T_BD_COSTBOM ADD (FSYNCTIME DATETIME );

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