/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BASE_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PROJECT_L' AND KSQL_COL_NAME IN ('FFULLNAME')) 
 ALTER TABLE T_BD_PROJECT_L ADD (FFULLNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PROJECT_L' AND KSQL_COL_NAME IN ('FPROADDRESS')) 
 ALTER TABLE T_BD_PROJECT_L ADD (FPROADDRESS NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PROJECT' AND KSQL_COL_NAME IN ('FLONGNUMBER')) 
 ALTER TABLE T_BD_PROJECT ADD (FLONGNUMBER NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PROJECT' AND KSQL_COL_NAME IN ('FLEVEL')) 
 ALTER TABLE T_BD_PROJECT ADD (FLEVEL INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PROJECT' AND KSQL_COL_NAME IN ('FISLEAF')) 
 ALTER TABLE T_BD_PROJECT ADD (FISLEAF CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PROJECT' AND KSQL_COL_NAME IN ('FPARENTID')) 
 ALTER TABLE T_BD_PROJECT ADD (FPARENTID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PROJECT' AND KSQL_COL_NAME IN ('FKINDID')) 
 ALTER TABLE T_BD_PROJECT ADD (FKINDID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PROJECT' AND KSQL_COL_NAME IN ('FPLANBEGINDATE')) 
 ALTER TABLE T_BD_PROJECT ADD (FPLANBEGINDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PROJECT' AND KSQL_COL_NAME IN ('FPLANENDDATE')) 
 ALTER TABLE T_BD_PROJECT ADD (FPLANENDDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PROJECT' AND KSQL_COL_NAME IN ('FPROSTATUS')) 
 ALTER TABLE T_BD_PROJECT ADD (FPROSTATUS BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PROJECT' AND KSQL_COL_NAME IN ('FUSEORGID')) 
 ALTER TABLE T_BD_PROJECT ADD (FUSEORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_PROJECT' AND KSQL_COL_NAME IN ('FISSYS')) 
 ALTER TABLE T_BD_PROJECT ADD (FISSYS CHAR(1) DEFAULT '0' NOT NULL );

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