/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BCM_table.sql **/
 EXEC p_AlterColumn 'T_BCM_USERSELECT', 'FAPPLICATION', 'VARCHAR(4)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_BCM_TMPLCOLDIM_L', 'FPKID', 'VARCHAR(18)', 'NOT NULL', '1111', ''' ''';

 EXEC p_AlterColumn 'T_BCM_TMPLCOLDIM_L', 'FLOCALEID', 'VARCHAR(20)', 'NOT NULL', '0001', ''' ''';

 EXEC p_AlterColumn 'T_BCM_TMPLCOLDIM_L', 'FHEADER', 'VARCHAR(50)', 'NOT NULL', '0001', ''' ''';

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_INVELIMTEMPLATE_L' AND KSQL_COL_NAME IN ('FNAME')) 
 ALTER TABLE T_BCM_INVELIMTEMPLATE_L ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVCHANGEACCTSET') 
 CREATE TABLE T_BCM_INVCHANGEACCTSET (
FID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FACCOUNTID BIGINT DEFAULT 0 NOT NULL
);


 EXEC p_AlterColumn 'T_BCM_TEMPLATE', 'FNUMBER', 'NVARCHAR(50)', 'NOT NULL', '0100', ''' ''';

 --- drop TABLE --------- 请认真检查该脚本 ------------------- 
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVCHANGEACCTSETTING') 
 DROP TABLE T_BCM_INVCHANGEACCTSETTING;


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