/**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_ISDIMMAPSRCDEFVAL' AND KSQL_COL_NAME ='FSOUCEMEMNUM') 
 ALTER TABLE T_BCM_ISDIMMAPSRCDEFVAL ADD (FSOUCEMEMNUM VARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISDIMMAPTARGDEFVAL' AND KSQL_COL_NAME ='FTARGETMEMNUM') 
 ALTER TABLE T_BCM_ISDIMMAPTARGDEFVAL ADD (FTARGETMEMNUM VARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISDIMMAPSRCDEFVAL_L' AND KSQL_COL_NAME ='FDETAILID') 
 ALTER TABLE T_BCM_ISDIMMAPSRCDEFVAL_L ADD (FDETAILID BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BCM_ISDIMMAPSRCDEFVAL_L', 'FID', 'NULL', 'NULL', '1001', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_ISDIMMAPTARGDEFVAL_L' AND KSQL_COL_NAME ='FDETAILID') 
 ALTER TABLE T_BCM_ISDIMMAPTARGDEFVAL_L ADD (FDETAILID BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BCM_ISDIMMAPTARGDEFVAL_L', 'FID', 'NULL', 'NULL', '1001', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ANNACCOUNTBEFORE') 
 CREATE TABLE T_BCM_ANNACCOUNTBEFORE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FDIMENSIONID BIGINT DEFAULT 0 NOT NULL,
FDIMENSIONMEMBERID BIGINT DEFAULT 0 NOT NULL,
FSCOPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FDIMMEMBERNUM NVARCHAR(80) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ANNUALACCOUNT') 
 CREATE TABLE T_BCM_ANNUALACCOUNT (
FID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FACCOUNTID BIGINT DEFAULT 0 NOT NULL,
FCHANGETYPEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_STRUCTOFENTPART') 
 CREATE TABLE T_BCM_STRUCTOFENTPART (
FID BIGINT DEFAULT 0 NOT NULL,
FMERGERNODE CHAR(1) DEFAULT '0' NOT NULL,
FISOFFSETENTRY CHAR(1) DEFAULT '0' NOT NULL
);



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