/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSOUTBILL' AND KSQL_COL_NAME IN ('FSETTLESCURRENCY')) 
 ALTER TABLE T_IM_TRANSOUTBILL ADD (FSETTLESCURRENCY BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_IM_TRANSOUTBILL', 'FINVDC', 'NULL', 'NULL', '1001', 'NULL';

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

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

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

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSINBILL' AND KSQL_COL_NAME IN ('FSETTLESCURRENCY')) 
 ALTER TABLE T_IM_TRANSINBILL ADD (FSETTLESCURRENCY BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_IM_TRANSINBILL', 'FBIZORGID', 'NULL', 'NULL', '1001', 'NULL';

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

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

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILL' AND KSQL_COL_NAME IN ('FOUTORGID')) 
 ALTER TABLE T_IM_TRANSDIRBILL ADD (FOUTORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILL' AND KSQL_COL_NAME IN ('FOUTOPERATOR')) 
 ALTER TABLE T_IM_TRANSDIRBILL ADD (FOUTOPERATOR BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILL' AND KSQL_COL_NAME IN ('FOUTDEPT')) 
 ALTER TABLE T_IM_TRANSDIRBILL ADD (FOUTDEPT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILL' AND KSQL_COL_NAME IN ('FOUTOPERATORGROUP')) 
 ALTER TABLE T_IM_TRANSDIRBILL ADD (FOUTOPERATORGROUP BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILL' AND KSQL_COL_NAME IN ('FSETTLESCURRENCY')) 
 ALTER TABLE T_IM_TRANSDIRBILL ADD (FSETTLESCURRENCY BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_IM_TRANSDIRBILL', 'FBIZORGID', 'NULL', 'NULL', '1001', 'NULL';

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

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

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSINBILLENTRY' AND KSQL_COL_NAME IN ('FPRICE')) 
 ALTER TABLE T_IM_TRANSINBILLENTRY ADD (FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSINBILLENTRY' AND KSQL_COL_NAME IN ('FAMOUNT')) 
 ALTER TABLE T_IM_TRANSINBILLENTRY ADD (FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_IM_TRANSINBILLENTRY', 'FENTRYDC', 'NULL', 'NULL', '1001', 'NULL';

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

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

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

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

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

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

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

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

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

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

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

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

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSOUTBILLENTRY' AND KSQL_COL_NAME IN ('FPRICE')) 
 ALTER TABLE T_IM_TRANSOUTBILLENTRY ADD (FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSOUTBILLENTRY' AND KSQL_COL_NAME IN ('FAMOUNT')) 
 ALTER TABLE T_IM_TRANSOUTBILLENTRY ADD (FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_IM_TRANSOUTBILLENTRY', 'FENTRYDC', 'NULL', 'NULL', '1001', 'NULL';

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

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

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

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

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

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

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

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

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

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

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

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSOUTBILLENTRY_X' AND KSQL_COL_NAME IN ('FOUTOWNERTYPE')) 
 ALTER TABLE T_IM_TRANSOUTBILLENTRY_X ADD (FOUTOWNERTYPE VARCHAR(36) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSOUTBILLENTRY_X' AND KSQL_COL_NAME IN ('FOUTOWNERID')) 
 ALTER TABLE T_IM_TRANSOUTBILLENTRY_X ADD (FOUTOWNERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSOUTBILLENTRY_X' AND KSQL_COL_NAME IN ('FOUTKEEPERTYPE')) 
 ALTER TABLE T_IM_TRANSOUTBILLENTRY_X ADD (FOUTKEEPERTYPE VARCHAR(36) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSOUTBILLENTRY_X' AND KSQL_COL_NAME IN ('FOUTKEEPERID')) 
 ALTER TABLE T_IM_TRANSOUTBILLENTRY_X ADD (FOUTKEEPERID BIGINT DEFAULT 0 NOT NULL );
 EXEC p_AlterColumn 'T_IM_TRANSDIRBILLENTRY_X', 'FENTRYCOMMENT', 'VARCHAR(512)', 'NOT NULL', '0011', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILLENTRY_X' AND KSQL_COL_NAME IN ('FOUTOWNERTYPE')) 
 ALTER TABLE T_IM_TRANSDIRBILLENTRY_X ADD (FOUTOWNERTYPE VARCHAR(36) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILLENTRY_X' AND KSQL_COL_NAME IN ('FOUTOWNERID')) 
 ALTER TABLE T_IM_TRANSDIRBILLENTRY_X ADD (FOUTOWNERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILLENTRY_X' AND KSQL_COL_NAME IN ('FOUTKEEPERTYPE')) 
 ALTER TABLE T_IM_TRANSDIRBILLENTRY_X ADD (FOUTKEEPERTYPE VARCHAR(36) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILLENTRY_X' AND KSQL_COL_NAME IN ('FOUTKEEPERID')) 
 ALTER TABLE T_IM_TRANSDIRBILLENTRY_X ADD (FOUTKEEPERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILLENTRY_X' AND KSQL_COL_NAME IN ('FOUTWAREHOUSEID')) 
 ALTER TABLE T_IM_TRANSDIRBILLENTRY_X ADD (FOUTWAREHOUSEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILLENTRY_X' AND KSQL_COL_NAME IN ('FOUTINVSTATUSID')) 
 ALTER TABLE T_IM_TRANSDIRBILLENTRY_X ADD (FOUTINVSTATUSID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILLENTRY_X' AND KSQL_COL_NAME IN ('FOUTINVTYPEID')) 
 ALTER TABLE T_IM_TRANSDIRBILLENTRY_X ADD (FOUTINVTYPEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILLENTRY_X' AND KSQL_COL_NAME IN ('FOUTLOCATIONID')) 
 ALTER TABLE T_IM_TRANSDIRBILLENTRY_X ADD (FOUTLOCATIONID BIGINT DEFAULT 0 NOT NULL );
 EXEC p_AlterColumn 'T_IM_SALOUTBILLENTRY_F', 'FACTUALPRICE', 'DECIMAL(23,10)', 'NOT NULL', '0011', '0';

 EXEC p_AlterColumn 'T_IM_SALOUTBILLENTRY_F', 'FACTUALTAXPRICE', 'DECIMAL(23,10)', 'NOT NULL', '0011', '0';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILLENTRY' AND KSQL_COL_NAME IN ('FPRICE')) 
 ALTER TABLE T_IM_TRANSDIRBILLENTRY ADD (FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILLENTRY' AND KSQL_COL_NAME IN ('FAMOUNT')) 
 ALTER TABLE T_IM_TRANSDIRBILLENTRY ADD (FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_IM_TRANSDIRBILLENTRY', 'FENTRYDC', 'NULL', 'NULL', '1001', 'NULL';

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

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

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

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

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_OTHEROUTBILLENTRY_F') 
 CREATE TABLE T_IM_OTHEROUTBILLENTRY_F (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_OTHEROUTBILL' AND KSQL_COL_NAME IN ('FSETTLECURRENCYID')) 
 ALTER TABLE T_IM_OTHEROUTBILL ADD (FSETTLECURRENCYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_OTHERINBILL' AND KSQL_COL_NAME IN ('FCUSTOMERID')) 
 ALTER TABLE T_IM_OTHERINBILL ADD (FCUSTOMERID BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_IM_OTHERINBILLENTRY', 'FQTYINVUNIT', 'NULL', 'NULL', '1001', 'NULL';

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

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

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

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

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

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

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

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

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSAPPLYENTRY' AND KSQL_COL_NAME IN ('FQTYUNIT2ND')) 
 ALTER TABLE T_IM_TRANSAPPLYENTRY ADD (FQTYUNIT2ND DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSAPPLYENTRY' AND KSQL_COL_NAME IN ('FUNIT2NDID')) 
 ALTER TABLE T_IM_TRANSAPPLYENTRY ADD (FUNIT2NDID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSAPPLYENTRY' AND KSQL_COL_NAME IN ('FUNIT2NDRATE')) 
 ALTER TABLE T_IM_TRANSAPPLYENTRY ADD (FUNIT2NDRATE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSAPPLYENTRY' AND KSQL_COL_NAME IN ('FININVSTATUS')) 
 ALTER TABLE T_IM_TRANSAPPLYENTRY ADD (FININVSTATUS BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSAPPLYENTRY' AND KSQL_COL_NAME IN ('FININVTYPE')) 
 ALTER TABLE T_IM_TRANSAPPLYENTRY ADD (FININVTYPE BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_PRODUCTINBILL') 
 CREATE TABLE T_IM_PRODUCTINBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(60) DEFAULT ' ' NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FINVDC NVARCHAR(5) DEFAULT ' ' NOT NULL,
FBIZORGID BIGINT DEFAULT 0 NOT NULL,
FBIZDEPTID BIGINT DEFAULT 0 NOT NULL,
FDEPTID BIGINT DEFAULT 0 NOT NULL,
FOPERATORGROUPID BIGINT DEFAULT 0 NOT NULL,
FOPERATORID BIGINT DEFAULT 0 NOT NULL,
FBIZOPERATORGROUPID BIGINT DEFAULT 0 NOT NULL,
FBIZOPERATORID BIGINT DEFAULT 0 NOT NULL,
FBIZTIME BIGINT DEFAULT 0 NOT NULL,
FBIZTYPEID DATETIME,
FINVSCHEMEID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_PRODUCTINBILLENTRY') 
 CREATE TABLE T_IM_PRODUCTINBILLENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT2NDID BIGINT DEFAULT 0 NOT NULL,
FBASEUNITID BIGINT DEFAULT 0 NOT NULL,
FQTYUNIT2ND DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FENTRYORGID BIGINT DEFAULT 0 NOT NULL,
FQTYUNIT3RD DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT3RDID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FLOCATIONID BIGINT DEFAULT 0 NOT NULL,
FINVSTATUSID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FPRODUCEDATE DATETIME,
FEXPIRYDATE DATETIME,
FENTRYCOMMENT NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOWNERTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FKEEPERTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FOWNERID BIGINT DEFAULT 0 NOT NULL,
FKEEPERID BIGINT DEFAULT 0 NOT NULL,
FLOTNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FUNITRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT2NDRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT3RDRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAUXPTYID BIGINT DEFAULT 0 NOT NULL,
FINVTYPEID BIGINT DEFAULT 0 NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FMATERIALMASTERID BIGINT DEFAULT 0 NOT NULL,
FOUTINVSTATUSID BIGINT DEFAULT 0 NOT NULL,
FOUTINVTYPEID BIGINT DEFAULT 0 NOT NULL,
FOUTOWNERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FOUTOWNERID BIGINT DEFAULT 0 NOT NULL,
FOUTKEEPERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FOUTKEEPERID BIGINT DEFAULT 0 NOT NULL,
FMAINDEPTID BIGINT DEFAULT 0 NOT NULL,
FRETURNSBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRETURNSQTY DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_INVBILLSNENTRY') 
 CREATE TABLE T_IM_INVBILLSNENTRY (
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSERIALNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSERIALCOMMENT NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSERIALID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MREQOUTBILL') 
 CREATE TABLE T_IM_MREQOUTBILL (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORGID BIGINT DEFAULT 0 NOT NULL,
FBILLTYPEID BIGINT DEFAULT 0 NOT NULL,
FBIZORGID BIGINT DEFAULT 0 NOT NULL,
FBIZDEPTID BIGINT DEFAULT 0 NOT NULL,
FDEPTID BIGINT DEFAULT 0 NOT NULL,
FOPERATORGROUPID BIGINT DEFAULT 0 NOT NULL,
FOPERATORID BIGINT DEFAULT 0 NOT NULL,
FBIZTIME DATETIME,
FBIZTYPEID BIGINT DEFAULT 0 NOT NULL,
FINVSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FSUPPLYOWNERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FSUPPLYOWNER BIGINT DEFAULT 0 NOT NULL,
FSETTLEORG BIGINT DEFAULT 0 NOT NULL,
FREQUSERID BIGINT DEFAULT 0 NOT NULL,
FCOSTCENTERORG BIGINT DEFAULT 0 NOT NULL,
FSETTLECURRENCY BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MREQOUTBILLENTRY') 
 CREATE TABLE T_IM_MREQOUTBILLENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALMASTERID BIGINT DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT2NDID BIGINT DEFAULT 0 NOT NULL,
FBASEUNITID BIGINT DEFAULT 0 NOT NULL,
FQTYUNIT2ND DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FENTRYORGID BIGINT DEFAULT 0 NOT NULL,
FQTYUNIT3RD DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT3RDID BIGINT DEFAULT 0 NOT NULL,
FUNITRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT2NDRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNIT3RDRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAUXPTYID BIGINT DEFAULT 0 NOT NULL,
FWAREHOUSEID BIGINT DEFAULT 0 NOT NULL,
FLOCATIONID BIGINT DEFAULT 0 NOT NULL,
FLOTID BIGINT DEFAULT 0 NOT NULL,
FLOTNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FPRODUCEDATE DATETIME,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FEXPIRYDATE DATETIME,
FENTRYCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL,
FOWNERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FKEEPERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FOWNERID BIGINT DEFAULT 0 NOT NULL,
FKEEPERID BIGINT DEFAULT 0 NOT NULL,
FINVSTATUSID BIGINT DEFAULT 0 NOT NULL,
FINVTYPEID BIGINT DEFAULT 0 NOT NULL,
FOUTINVSTATUSID BIGINT DEFAULT 0 NOT NULL,
FOUTINVTYPEID BIGINT DEFAULT 0 NOT NULL,
FOUTOWNERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FOUTOWNERID BIGINT DEFAULT 0 NOT NULL,
FOUTKEEPERTYPE NVARCHAR(30) DEFAULT ' ' NOT NULL,
FOUTKEEPERID BIGINT DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MREQOUTBILLENTRY_R') 
 CREATE TABLE T_IM_MREQOUTBILLENTRY_R (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSRCBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FMAINBILLNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMAINBILLID BIGINT DEFAULT 0 NOT NULL,
FMAINBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FMAINBILLENTITY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FMAINBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL,
FRETURNBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREMAINRETURNBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FRETURNQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FREMAINRETURNQTY DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_PRODUCTINBILLENTRY_R') 
 CREATE TABLE T_IM_PRODUCTINBILLENTRY_R (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLENTITY NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSRCBILLID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLENTRYID BIGINT DEFAULT 0 NOT NULL,
FSRCBILLNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSRCBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_PRODUCTINBILLENTRY_X') 
 CREATE TABLE T_IM_PRODUCTINBILLENTRY_X (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_PRODUCTINBILL_L') 
 CREATE TABLE T_IM_PRODUCTINBILL_L (
FPKID NVARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_MREQOUTBILLSNENTRY') 
 CREATE TABLE T_IM_MREQOUTBILLSNENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSERIALNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSERIALCOMMENT NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSERIALID BIGINT DEFAULT 0 NOT NULL
);


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

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

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

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

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

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

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_F' AND KSQL_COL_NAME IN ('FACTUALPRICE')) 
 ALTER TABLE T_IM_PURRECBILLENTRY_F ADD (FACTUALPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_F' AND KSQL_COL_NAME IN ('FACTUALTAXPRICE')) 
 ALTER TABLE T_IM_PURRECBILLENTRY_F ADD (FACTUALTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_IM_PURRECBILLENTRY_F', 'FENTRYSETTLEDEPTID', 'NULL', 'NULL', '1001', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_R' AND KSQL_COL_NAME IN ('FPURBILLNUMBER')) 
 ALTER TABLE T_IM_PURRECBILLENTRY_R ADD (FPURBILLNUMBER BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_R' AND KSQL_COL_NAME IN ('FPURBILLENTRYID')) 
 ALTER TABLE T_IM_PURRECBILLENTRY_R ADD (FPURBILLENTRYID BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_IM_PURRECBILLENTRY', 'FQTYINVUNIT', 'NULL', 'NULL', '1001', 'NULL';

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

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

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

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

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

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

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

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

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_D' AND KSQL_COL_NAME IN ('FPROVIDERSUPPLIERID')) 
 ALTER TABLE T_IM_PURRECBILLENTRY_D ADD (FPROVIDERSUPPLIERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_D' AND KSQL_COL_NAME IN ('FPROVIDERADDRESS')) 
 ALTER TABLE T_IM_PURRECBILLENTRY_D ADD (FPROVIDERADDRESS NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_D' AND KSQL_COL_NAME IN ('FPROVIDERLINKMANID')) 
 ALTER TABLE T_IM_PURRECBILLENTRY_D ADD (FPROVIDERLINKMANID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_D' AND KSQL_COL_NAME IN ('FINVOICESUPPLIERID')) 
 ALTER TABLE T_IM_PURRECBILLENTRY_D ADD (FINVOICESUPPLIERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_D' AND KSQL_COL_NAME IN ('FRECEIVESUPPLIERID')) 
 ALTER TABLE T_IM_PURRECBILLENTRY_D ADD (FRECEIVESUPPLIERID BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_IM_PURRECBILLENTRY_D', 'FENTRYREQDEPTID', 'NULL', 'NULL', '1001', 'NULL';


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