/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest(平台_业务)\pdm\BCM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_TEMPLATECATALOG' AND KSQL_COL_NAME IN ('FSEQUENCE')) 
 ALTER TABLE T_BCM_TEMPLATECATALOG ADD (FSEQUENCE INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ACCOUNTINGENTITY') 
 CREATE TABLE T_BCM_ACCOUNTINGENTITY (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSYSSOURCE BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_CHKDISPLAYSETTING' AND KSQL_COL_NAME IN ('FMODELID')) 
 ALTER TABLE T_BCM_CHKDISPLAYSETTING ADD (FMODELID BIGINT DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_TEMPLATE' AND KSQL_COL_NAME IN ('FSEQUENCE')) 
 ALTER TABLE T_BCM_TEMPLATE ADD (FSEQUENCE INT DEFAULT 0 NOT NULL );

/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest(平台_业务)\pdm\BCM_table.sql **/
