/**Begin D:\PDM_UPGRADE\PDM1\BASE_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMERBANK' AND KSQL_COL_NAME ='FACCOUNTNAME') 
 ALTER TABLE T_BD_CUSTOMERBANK ADD (FACCOUNTNAME NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CSGROUPSTANDARD' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_CSGROUPSTANDARD ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CSGROUPSTANDARD' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_CSGROUPSTANDARD ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SPGROUPSTANDARD' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_SPGROUPSTANDARD ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SPGROUPSTANDARD' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_SPGROUPSTANDARD ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMERGROUP' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_CUSTOMERGROUP ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMERGROUP' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_CUSTOMERGROUP ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERGROUP' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_SUPPLIERGROUP ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERGROUP' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_SUPPLIERGROUP ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_MTGROUPSTANDARD' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_MTGROUPSTANDARD ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_MTGROUPSTANDARD' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_MTGROUPSTANDARD ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_MATERIALGROUP' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_MATERIALGROUP ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_MATERIALGROUP' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_MATERIALGROUP ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERBANK' AND KSQL_COL_NAME ='FACCOUNTNAME') 
 ALTER TABLE T_BD_SUPPLIERBANK ADD (FACCOUNTNAME NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_BOMVERSION' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_BOMVERSION ADD (FNAME VARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERSITEBANK' AND KSQL_COL_NAME ='FACCOUNTNAME') 
 ALTER TABLE T_BD_SUPPLIERSITEBANK ADD (FACCOUNTNAME NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERADDRESS_L' AND KSQL_COL_NAME ='FDETAILADDRESS') 
 ALTER TABLE T_BD_SUPPLIERADDRESS_L ADD (FDETAILADDRESS NVARCHAR(300) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERLINKMAN' AND KSQL_COL_NAME ='FCONTACTPERSON') 
 ALTER TABLE T_BD_SUPPLIERLINKMAN ADD (FCONTACTPERSON NVARCHAR(40) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERLINKMAN' AND KSQL_COL_NAME ='FCONTACTPERSONPOST') 
 ALTER TABLE T_BD_SUPPLIERLINKMAN ADD (FCONTACTPERSONPOST NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERLINKMAN' AND KSQL_COL_NAME ='FDEPT') 
 ALTER TABLE T_BD_SUPPLIERLINKMAN ADD (FDEPT NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMERLINKMAN' AND KSQL_COL_NAME ='FCONTACTPERSON') 
 ALTER TABLE T_BD_CUSTOMERLINKMAN ADD (FCONTACTPERSON NVARCHAR(40) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMERLINKMAN' AND KSQL_COL_NAME ='FCONTACTPERSONPOST') 
 ALTER TABLE T_BD_CUSTOMERLINKMAN ADD (FCONTACTPERSONPOST NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMERLINKMAN' AND KSQL_COL_NAME ='FDEPT') 
 ALTER TABLE T_BD_CUSTOMERLINKMAN ADD (FDEPT NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERADDRESS' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_SUPPLIERADDRESS ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERADDRESS' AND KSQL_COL_NAME ='FPHONE') 
 ALTER TABLE T_BD_SUPPLIERADDRESS ADD (FPHONE NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIERSITE' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_SUPPLIERSITE ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_BIZPARTNER' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_BIZPARTNER ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_BIZPARTNER' AND KSQL_COL_NAME ='FSIMPLENAME') 
 ALTER TABLE T_BD_BIZPARTNER ADD (FSIMPLENAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_BIZPARTNER' AND KSQL_COL_NAME ='FADDRESS') 
 ALTER TABLE T_BD_BIZPARTNER ADD (FADDRESS NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_BIZPARTNER' AND KSQL_COL_NAME ='FLINKMAN') 
 ALTER TABLE T_BD_BIZPARTNER ADD (FLINKMAN NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_BIZPARTNER' AND KSQL_COL_NAME ='FARTIFICIALPERSON') 
 ALTER TABLE T_BD_BIZPARTNER ADD (FARTIFICIALPERSON NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_BIZPARTNER' AND KSQL_COL_NAME ='FREGCAPITAL') 
 ALTER TABLE T_BD_BIZPARTNER ADD (FREGCAPITAL NVARCHAR(20) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_BIZPARTNER' AND KSQL_COL_NAME ='FBUSINESSTERM') 
 ALTER TABLE T_BD_BIZPARTNER ADD (FBUSINESSTERM NVARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_BIZPARTNER' AND KSQL_COL_NAME ='FBUSINESSSCOPE') 
 ALTER TABLE T_BD_BIZPARTNER ADD (FBUSINESSSCOPE NVARCHAR(2000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIER' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_SUPPLIER ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIER' AND KSQL_COL_NAME ='FSIMPLENAME') 
 ALTER TABLE T_BD_SUPPLIER ADD (FSIMPLENAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIER' AND KSQL_COL_NAME ='FADDRESS') 
 ALTER TABLE T_BD_SUPPLIER ADD (FADDRESS NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIER' AND KSQL_COL_NAME ='FLINKMAN') 
 ALTER TABLE T_BD_SUPPLIER ADD (FLINKMAN NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIER' AND KSQL_COL_NAME ='FARTIFICIALPERSON') 
 ALTER TABLE T_BD_SUPPLIER ADD (FARTIFICIALPERSON NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIER' AND KSQL_COL_NAME ='FREGCAPITAL') 
 ALTER TABLE T_BD_SUPPLIER ADD (FREGCAPITAL NVARCHAR(40) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIER' AND KSQL_COL_NAME ='FBUSINESSTERM') 
 ALTER TABLE T_BD_SUPPLIER ADD (FBUSINESSTERM NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_SUPPLIER' AND KSQL_COL_NAME ='FBUSINESSSCOPE') 
 ALTER TABLE T_BD_SUPPLIER ADD (FBUSINESSSCOPE NVARCHAR(2000) DEFAULT ' ' NOT NULL ); 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMER' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_CUSTOMER ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMER' AND KSQL_COL_NAME ='FSIMPLENAME') 
 ALTER TABLE T_BD_CUSTOMER ADD (FSIMPLENAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMER' AND KSQL_COL_NAME ='FADDRESS') 
 ALTER TABLE T_BD_CUSTOMER ADD (FADDRESS NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMER' AND KSQL_COL_NAME ='FARTIFICIALPERSON') 
 ALTER TABLE T_BD_CUSTOMER ADD (FARTIFICIALPERSON NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMER' AND KSQL_COL_NAME ='FREGCAPITAL') 
 ALTER TABLE T_BD_CUSTOMER ADD (FREGCAPITAL NVARCHAR(40) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMER' AND KSQL_COL_NAME ='FBUSINESSTERM') 
 ALTER TABLE T_BD_CUSTOMER ADD (FBUSINESSTERM NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMER' AND KSQL_COL_NAME ='FBUSINESSSCOPE') 
 ALTER TABLE T_BD_CUSTOMER ADD (FBUSINESSSCOPE NVARCHAR(2000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_CUSTOMER' AND KSQL_COL_NAME ='FLINKMAN') 
 ALTER TABLE T_BD_CUSTOMER ADD (FLINKMAN NVARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_MATERIAL' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_BD_MATERIAL ADD (FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_MATERIAL' AND KSQL_COL_NAME ='FMODEL') 
 ALTER TABLE T_BD_MATERIAL ADD (FMODEL NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_MATERIAL' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_BD_MATERIAL ADD (FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_MATERIAL_S' AND KSQL_COL_NAME ='FSPAREPART') 
 ALTER TABLE T_BD_MATERIAL_S ADD (FSPAREPART CHAR(1) DEFAULT '0' NOT NULL );
/**End D:\PDM_UPGRADE\PDM1\BASE_table.sql **/
