/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BOS_table.sql **/
 EXEC p_AlterColumn 'T_BD_ACCPURPOSE', 'FCOMMENT', 'NVARCHAR(255)', 'NOT NULL', '0011', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ACCPURPOSE' AND KSQL_COL_NAME ='FLONGNUMBER') 
 ALTER TABLE T_BD_ACCPURPOSE ADD (FLONGNUMBER NVARCHAR(500) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ACCPURPOSE' AND KSQL_COL_NAME ='FLEVEL') 
 ALTER TABLE T_BD_ACCPURPOSE ADD (FLEVEL INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ACCPURPOSE' AND KSQL_COL_NAME ='FISLEAF') 
 ALTER TABLE T_BD_ACCPURPOSE ADD (FISLEAF CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ACCPURPOSE' AND KSQL_COL_NAME ='FPARENTID') 
 ALTER TABLE T_BD_ACCPURPOSE ADD (FPARENTID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ACCPURPOSE' AND KSQL_COL_NAME ='FCREATEORGID') 
 ALTER TABLE T_BD_ACCPURPOSE ADD (FCREATEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ACCPURPOSE' AND KSQL_COL_NAME ='FORGID') 
 ALTER TABLE T_BD_ACCPURPOSE ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ACCPURPOSE' AND KSQL_COL_NAME ='FCTRLSTRATEGY') 
 ALTER TABLE T_BD_ACCPURPOSE ADD (FCTRLSTRATEGY NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ACCPURPOSE' AND KSQL_COL_NAME ='FENABLEDATE') 
 ALTER TABLE T_BD_ACCPURPOSE ADD (FENABLEDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ACCPURPOSE' AND KSQL_COL_NAME ='FDISABLEDATE') 
 ALTER TABLE T_BD_ACCPURPOSE ADD (FDISABLEDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_ACCPURPOSE_L' AND KSQL_COL_NAME ='FFULLNAME') 
 ALTER TABLE T_BD_ACCPURPOSE_L ADD (FFULLNAME NVARCHAR(500) DEFAULT ' ' NOT NULL );

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