/**Begin D:\PDM_UPGRADE\PDM1\HDM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HDM_TRANSFERBILL' AND KSQL_COL_NAME IN ('FSUPERIORCHANNEL')) 
 ALTER TABLE T_HDM_TRANSFERBILL ADD (FSUPERIORCHANNEL VARCHAR(2) DEFAULT ' ' NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_HDM_TRANSFERBILL_A', 'FBSTPOSITIONHISID', 'NULL', 'NULL', '1001', 'NULL';

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

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

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HDM_TRANSFERBILL_B' AND KSQL_COL_NAME IN ('FBCMPID')) 
 ALTER TABLE T_HDM_TRANSFERBILL_B ADD (FBCMPID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_OLDORGLEADER') 
 CREATE TABLE T_HDM_OLDORGLEADER (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID VARCHAR(60) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_OLDSUPERIOR') 
 CREATE TABLE T_HDM_OLDSUPERIOR (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID VARCHAR(60) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_NEWORGLEADER') 
 CREATE TABLE T_HDM_NEWORGLEADER (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID VARCHAR(60) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HDM_NEWSUPERIOR') 
 CREATE TABLE T_HDM_NEWSUPERIOR (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID VARCHAR(60) DEFAULT ' ' NOT NULL
);



/**End D:\PDM_UPGRADE\PDM1\HDM_table.sql **/
