/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\EB_table.sql **/
 EXEC p_AlterColumn 'T_BGM_PRODETAIL', 'FSEQ', 'BIGINT', 'NOT NULL', '1111', '0';

 EXEC p_AlterColumn 'T_BGM_PRODETAIL', 'FPRODESCRIBE', 'NVARCHAR(255)', 'NOT NULL', '0011', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM1') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM1 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM2') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM2 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM3') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM3 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM4') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM4 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM5') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM5 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM6') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM6 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM7') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM7 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM8') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM8 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM9') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM9 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM10') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM10 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM11') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM11 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM12') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM12 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM13') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM13 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM14') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM14 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIM15') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIM15 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID1') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID1 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID2') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID2 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID3') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID3 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID4') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID4 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID5') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID5 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID6') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID6 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID7') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID7 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID8') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID8 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID9') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID9 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID10') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID10 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID11') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID11 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID12') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID12 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID13') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID13 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID14') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID14 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FDIMID15') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FDIMID15 NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PRODETAIL' AND KSQL_COL_NAME ='FPROAMOUNT') 
 ALTER TABLE T_BGM_PRODETAIL ADD (FPROAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_BGM_PRODETAIL', 'FSUBJECT', 'NULL', 'NULL', '1001', 'NULL';

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BGM_PROJECTAPPLY' AND KSQL_COL_NAME ='FMETABLE') 
 ALTER TABLE T_BGM_PROJECTAPPLY ADD (FMETABLE NVARCHAR(2) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DYNAMICREPORT') 
 CREATE TABLE T_EB_DYNAMICREPORT (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FTASKPROCESSID BIGINT DEFAULT 0 NOT NULL,
FORG BIGINT DEFAULT 0 NOT NULL,
FTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FCREATEDATE DATETIME,
FMODIFYDATE DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_EXAMINECHECK') 
 CREATE TABLE T_EB_EXAMINECHECK (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FREPORTID BIGINT DEFAULT 0 NOT NULL,
FRESULTID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_EXAMINERESULT') 
 CREATE TABLE T_EB_EXAMINERESULT (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FRESULT NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_EXAMINECATEGORY') 
 CREATE TABLE T_EB_EXAMINECATEGORY (
FID BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCODE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPARENTID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FLEVEL INT DEFAULT 0 NOT NULL,
FISLEAF CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_EXECANALYZEHISTORY') 
 CREATE TABLE T_EB_EXECANALYZEHISTORY (
FID BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FCOSTTYPE BIGINT DEFAULT 0 NOT NULL,
FENTITY BIGINT DEFAULT 0 NOT NULL,
FYEAR BIGINT DEFAULT 0 NOT NULL,
FPERIOD BIGINT DEFAULT 0 NOT NULL,
FVESION BIGINT DEFAULT 0 NOT NULL,
FCURRENCY BIGINT DEFAULT 0 NOT NULL,
FAPPLICATION NVARCHAR(30) DEFAULT ' ' NOT NULL,
FFORMID NVARCHAR(100) DEFAULT ' ' NOT NULL,
FMODIFYER BIGINT DEFAULT 0 NOT NULL
);


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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_STARTPARAMTER' AND KSQL_COL_NAME ='FPARENT') 
 ALTER TABLE T_EB_STARTPARAMTER ADD (FPARENT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_TASKLIST' AND KSQL_COL_NAME ='FVERSIONID') 
 ALTER TABLE T_EB_TASKLIST ADD (FVERSIONID BIGINT DEFAULT 0 NOT NULL );
 EXEC p_AlterColumn 'T_EB_SCHEMEENTRY', 'FDIMCACHE', 'NCLOB', 'NULL', '1111', 'NULL';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_PJOTEMPLATECATA_L') 
 CREATE TABLE T_EB_PJOTEMPLATECATA_L (
FPKID NVARCHAR(30) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(1100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_ADJUSTBILL' AND KSQL_COL_NAME ='FHANDLERTEXT') 
 ALTER TABLE T_EB_ADJUSTBILL ADD (FHANDLERTEXT NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_PJOTEMPLATE' AND KSQL_COL_NAME ='FSTATUS') 
 ALTER TABLE T_EB_PJOTEMPLATE ADD (FSTATUS CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_PJOTEMPLATE' AND KSQL_COL_NAME ='FDEFINDIMENSION') 
 ALTER TABLE T_EB_PJOTEMPLATE ADD (FDEFINDIMENSION NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_PJOTEMPLATE' AND KSQL_COL_NAME ='FMONEYUNIT') 
 ALTER TABLE T_EB_PJOTEMPLATE ADD (FMONEYUNIT CHAR(2) DEFAULT '10' NOT NULL );
 EXEC p_AlterColumn 'T_EB_COSTTYPE', 'FDIMMEMNAME', 'NVARCHAR(100)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FENTITY') 
 ALTER TABLE T_EB_COSTTYPE ADD (FENTITY NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FCURRENCY') 
 ALTER TABLE T_EB_COSTTYPE ADD (FCURRENCY NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FYEAR') 
 ALTER TABLE T_EB_COSTTYPE ADD (FYEAR NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FPERIOD') 
 ALTER TABLE T_EB_COSTTYPE ADD (FPERIOD NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FVERSION') 
 ALTER TABLE T_EB_COSTTYPE ADD (FVERSION NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FENTITYRANG') 
 ALTER TABLE T_EB_COSTTYPE ADD (FENTITYRANG NVARCHAR(510) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FYEARRANG') 
 ALTER TABLE T_EB_COSTTYPE ADD (FYEARRANG NVARCHAR(510) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FPERIODRANG') 
 ALTER TABLE T_EB_COSTTYPE ADD (FPERIODRANG NVARCHAR(510) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FVERSIONRANG') 
 ALTER TABLE T_EB_COSTTYPE ADD (FVERSIONRANG NVARCHAR(510) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FCURRENCYRANG') 
 ALTER TABLE T_EB_COSTTYPE ADD (FCURRENCYRANG NVARCHAR(510) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FENTITYRANG_TAG') 
 ALTER TABLE T_EB_COSTTYPE ADD (FENTITYRANG_TAG NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FYEARRANG_TAG') 
 ALTER TABLE T_EB_COSTTYPE ADD (FYEARRANG_TAG NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FPERIODRANG_TAG') 
 ALTER TABLE T_EB_COSTTYPE ADD (FPERIODRANG_TAG NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FVERSIONRANG_TAG') 
 ALTER TABLE T_EB_COSTTYPE ADD (FVERSIONRANG_TAG NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FCURRENCYRANG_TAG') 
 ALTER TABLE T_EB_COSTTYPE ADD (FCURRENCYRANG_TAG NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FBASEDATAFIELD') 
 ALTER TABLE T_EB_COSTTYPE ADD (FBASEDATAFIELD BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FBASEDATAFIELD1') 
 ALTER TABLE T_EB_COSTTYPE ADD (FBASEDATAFIELD1 BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FBASEDATAFIELD2') 
 ALTER TABLE T_EB_COSTTYPE ADD (FBASEDATAFIELD2 BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FBASEDATAFIELD3') 
 ALTER TABLE T_EB_COSTTYPE ADD (FBASEDATAFIELD3 BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_COSTTYPE' AND KSQL_COL_NAME ='FBASEDATAFIELD4') 
 ALTER TABLE T_EB_COSTTYPE ADD (FBASEDATAFIELD4 BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 ------------------- 
 EXEC p_AlterColumn 'T_EB_COSTTYPE', 'ENTITY', 'NULL', 'NULL', '1001', 'NULL';

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

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

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

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

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

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

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

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

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

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

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

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

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

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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_PJOTEMCLODIM' AND KSQL_COL_NAME ='FRANGE') 
 ALTER TABLE T_EB_PJOTEMCLODIM ADD (FRANGE NVARCHAR(2000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_EXAMINE') 
 CREATE TABLE T_EB_EXAMINE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FGROUP BIGINT DEFAULT 0 NOT NULL,
FISCONNTEMP CHAR(1) DEFAULT '0' NOT NULL,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FMODIFYDATE DATETIME,
FCREATEORG BIGINT DEFAULT 0 NOT NULL,
FSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FFORMULASHOW NVARCHAR(1000) DEFAULT ' ' NOT NULL,
FFAILOVERWAY CHAR(1) DEFAULT '0' NOT NULL,
FCHECKINFLUENCE CHAR(1) DEFAULT '0' NOT NULL,
FFAILOVERVAL DECIMAL(23,10) DEFAULT 0 NOT NULL,
FFORMULA NVARCHAR(1000) DEFAULT ' ' NOT NULL,
FRANGEDIMINFO NCLOB,
FMEMBERINFO NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_TEMPLATE' AND KSQL_COL_NAME ='FDATAUNIT') 
 ALTER TABLE T_EB_TEMPLATE ADD (FDATAUNIT NVARCHAR(2) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_EB_TEMPLATE' AND KSQL_COL_NAME ='FVARBASEFOREB') 
 ALTER TABLE T_EB_TEMPLATE ADD (FVARBASEFOREB NVARCHAR(80) DEFAULT ' ' NOT NULL );

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