/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\EB_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_ANALYSISTHEMETYPE' AND KSQL_COL_NAME IN ('FPARENTID')) 
 ALTER TABLE T_EB_ANALYSISTHEMETYPE ADD (FPARENTID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_ANALYSISTHEMETYPE' AND KSQL_COL_NAME IN ('FLEVEL')) 
 ALTER TABLE T_EB_ANALYSISTHEMETYPE ADD (FLEVEL INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_ANALYSISTHEMETYPE' AND KSQL_COL_NAME IN ('FISLEAF')) 
 ALTER TABLE T_EB_ANALYSISTHEMETYPE ADD (FISLEAF CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_ANALYSISCHART' AND KSQL_COL_NAME IN ('FTHEMETYPEID')) 
 ALTER TABLE T_EB_ANALYSISCHART ADD (FTHEMETYPEID BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_EB_ANALYSISCHART', 'FENTRYID', 'NULL', 'NULL', '1001', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_TASKPROCESS' AND KSQL_COL_NAME IN ('FASSIGNERID')) 
 ALTER TABLE T_EB_TASKPROCESS ADD (FASSIGNERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_MAPPINGBASEDATA') 
 CREATE TABLE T_EB_MAPPINGBASEDATA (
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAFIELD NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBASENAME NVARCHAR(255) DEFAULT ' ' NOT NULL
);



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