/**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_DIMMEMBERMAPPING' AND KSQL_COL_NAME ='FBDNAMEEXT') 
 ALTER TABLE T_EB_DIMMEMBERMAPPING ADD (FBDNAMEEXT NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_DIMMEMBERMAPPING' AND KSQL_COL_NAME ='FBUSINESSBASEDATAEXT') 
 ALTER TABLE T_EB_DIMMEMBERMAPPING ADD (FBUSINESSBASEDATAEXT NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_DIMMEMBERMAPPING' AND KSQL_COL_NAME ='FUSEASSISTDATA') 
 ALTER TABLE T_EB_DIMMEMBERMAPPING ADD (FUSEASSISTDATA CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_DIMMEMBERMAPPING' AND KSQL_COL_NAME ='FISEXITNOLEAF') 
 ALTER TABLE T_EB_DIMMEMBERMAPPING ADD (FISEXITNOLEAF CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_MEMBERMAPPING' AND KSQL_COL_NAME ='FRANGE') 
 ALTER TABLE T_EB_MEMBERMAPPING ADD (FRANGE NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_MEMBERMAPPING' AND KSQL_COL_NAME ='FBIZNAMEEXT') 
 ALTER TABLE T_EB_MEMBERMAPPING ADD (FBIZNAMEEXT NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_MEMBERMAPPING' AND KSQL_COL_NAME ='FBIZNUMBEREXT') 
 ALTER TABLE T_EB_MEMBERMAPPING ADD (FBIZNUMBEREXT NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_MEMBERMAPPING' AND KSQL_COL_NAME ='FBIZMEMBERIEXTID') 
 ALTER TABLE T_EB_MEMBERMAPPING ADD (FBIZMEMBERIEXTID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_INTEGRATION_MAP' AND KSQL_COL_NAME ='FDIMCOMBO') 
 ALTER TABLE T_EB_INTEGRATION_MAP ADD (FDIMCOMBO NVARCHAR(16) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_LEAFBIZRULETEMPDIS') 
 CREATE TABLE T_EB_LEAFBIZRULETEMPDIS (
FID BIGINT DEFAULT 0 NOT NULL,
FTEMPLATE BIGINT DEFAULT 0 NOT NULL,
FBIZRULE BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_INTEGRATION_MAPVAL' AND KSQL_COL_NAME ='FSOURCENUMBER') 
 ALTER TABLE T_EB_INTEGRATION_MAPVAL ADD (FSOURCENUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_INTEGRATION_MAPVAL' AND KSQL_COL_NAME ='FSOURCENAME') 
 ALTER TABLE T_EB_INTEGRATION_MAPVAL ADD (FSOURCENAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_INTEGRATION_MAPVAL' AND KSQL_COL_NAME ='FAIMNUMBER') 
 ALTER TABLE T_EB_INTEGRATION_MAPVAL ADD (FAIMNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_INTEGRATION_MAPVAL' AND KSQL_COL_NAME ='FAIMNAME') 
 ALTER TABLE T_EB_INTEGRATION_MAPVAL ADD (FAIMNAME NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_INTEGRATION_MAPVAL' AND KSQL_COL_NAME ='FSTATE') 
 ALTER TABLE T_EB_INTEGRATION_MAPVAL ADD (FSTATE CHAR(1) DEFAULT '1' NOT NULL );
 --- drop column --------- 不允许删除表T_EB_INTEGRATION_MAPVAL的字段SOURCENUMBER，请恢复pdm中的字段 ------------------- 
 --- drop column --------- 不允许删除表T_EB_INTEGRATION_MAPVAL的字段SOURCENAME，请恢复pdm中的字段 ------------------- 
 --- drop column --------- 不允许删除表T_EB_INTEGRATION_MAPVAL的字段AIMNUMBER，请恢复pdm中的字段 ------------------- 
 --- drop column --------- 不允许删除表T_EB_INTEGRATION_MAPVAL的字段AIMNAME，请恢复pdm中的字段 ------------------- 
 --- drop column --------- 不允许删除表T_EB_INTEGRATION_MAPVAL的字段STATE，请恢复pdm中的字段 ------------------- 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_BIZRULESET' AND KSQL_COL_NAME ='FDATASETID') 
 ALTER TABLE T_EB_BIZRULESET ADD (FDATASETID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_BIZRULESET' AND KSQL_COL_NAME ='FRULETYPE') 
 ALTER TABLE T_EB_BIZRULESET ADD (FRULETYPE CHAR(1) DEFAULT '0' NOT NULL );
 --- drop column --------- 不允许删除表T_EB_BIZRULESET的字段FBROADFLAG，请恢复pdm中的字段 ------------------- 

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