/**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_CONTROLRULEACCOUNT' AND KSQL_COL_NAME IN ('FSEQ')) 
 ALTER TABLE T_EB_CONTROLRULEACCOUNT ADD (FSEQ BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_CONTROLRULEDEFINEDS' AND KSQL_COL_NAME IN ('FSEQ')) 
 ALTER TABLE T_EB_CONTROLRULEDEFINEDS ADD (FSEQ BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_CONTROLRULEMAIN' AND KSQL_COL_NAME IN ('FSEQ')) 
 ALTER TABLE T_EB_CONTROLRULEMAIN ADD (FSEQ BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_STRUCTOFBILL' AND KSQL_COL_NAME IN ('FISFROMOUTER')) 
 ALTER TABLE T_EB_STRUCTOFBILL ADD (FISFROMOUTER CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_STRUCTOFBILL' AND KSQL_COL_NAME IN ('FBILLTYPE')) 
 ALTER TABLE T_EB_STRUCTOFBILL ADD (FBILLTYPE NVARCHAR(20) DEFAULT ' ' NOT NULL );
 EXEC p_AlterColumn 'T_EB_MEMBERMAPPING', 'FENTRYSTATUS', 'CHAR(1)', 'NOT NULL', '0001', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_MEMBERMAPPING' AND KSQL_COL_NAME IN ('FBIZMEMBERID')) 
 ALTER TABLE T_EB_MEMBERMAPPING ADD (FBIZMEMBERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_MEMBERMAPPING' AND KSQL_COL_NAME IN ('FBIZNUMBER')) 
 ALTER TABLE T_EB_MEMBERMAPPING ADD (FBIZNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_MEMBERMAPPING' AND KSQL_COL_NAME IN ('FBIZNAME')) 
 ALTER TABLE T_EB_MEMBERMAPPING ADD (FBIZNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_MEMBERMAPPING' AND KSQL_COL_NAME IN ('FDIMMEMBERID')) 
 ALTER TABLE T_EB_MEMBERMAPPING ADD (FDIMMEMBERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_MEMBERMAPPING' AND KSQL_COL_NAME IN ('FDIMMEMNUMBER')) 
 ALTER TABLE T_EB_MEMBERMAPPING ADD (FDIMMEMNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_MEMBERMAPPING' AND KSQL_COL_NAME IN ('FDIMMEMNAME')) 
 ALTER TABLE T_EB_MEMBERMAPPING ADD (FDIMMEMNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_EB_MEMBERMAPPING', 'FBASEDATAFIELD', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_EB_MEMBERMAPPING', 'FBASEDATAFIELD1', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_EB_MEMBERMAPPING', 'FDIMMEMBER', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_EB_MEMBERMAPPING', 'FITEMCLASSTYPEFIELD', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_EB_MEMBERMAPPING', 'FITEMCLASSFIELD', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_EB_MEMBERMAPPING', 'FBUSINESSBDMEMBER', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_EB_MEMBERMAPPING', 'FTEXTFIELD', 'NULL', 'NULL', '1001', 'NULL';

 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_EB_MEMBERMAPPING', 'FTEXTFIELD1', 'NULL', 'NULL', '1001', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_TASKMONITOR') 
 CREATE TABLE T_EB_TASKMONITOR (
FID BIGINT DEFAULT 0 NOT NULL,
FTASK NVARCHAR(30) DEFAULT ' ' NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FTASKSTATE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FORGFIELD BIGINT DEFAULT 0 NOT NULL
);



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