/**Begin C:\PDM_UPGRADE\PDM1\PUR_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_ORDERENTRY' AND KSQL_COL_NAME IN ('FMATERIALNAMETEXT')) 
 ALTER TABLE T_PUR_ORDERENTRY ADD (FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_ORDCHANGENTRY' AND KSQL_COL_NAME IN ('FMATERIALNAMETEXT')) 
 ALTER TABLE T_PUR_ORDCHANGENTRY ADD (FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_SALOUTSTOCKENTRY' AND KSQL_COL_NAME IN ('FMATERIALNAMETEXT')) 
 ALTER TABLE T_PUR_SALOUTSTOCKENTRY ADD (FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_RECEIPTENTRY' AND KSQL_COL_NAME IN ('FMATERIALNAMETEXT')) 
 ALTER TABLE T_PUR_RECEIPTENTRY ADD (FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INSTOCKENTRY' AND KSQL_COL_NAME IN ('FMATERIALNAMETEXT')) 
 ALTER TABLE T_PUR_INSTOCKENTRY ADD (FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_REQUESTENTRY' AND KSQL_COL_NAME IN ('FMATERIALNAMETEXT')) 
 ALTER TABLE T_PUR_REQUESTENTRY ADD (FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_RETURNENTRY' AND KSQL_COL_NAME IN ('FMATERIALNAMETEXT')) 
 ALTER TABLE T_PUR_RETURNENTRY ADD (FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_CHECKENTRY2' AND KSQL_COL_NAME IN ('FMATERIALNAMETEXT')) 
 ALTER TABLE T_PUR_CHECKENTRY2 ADD (FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_CHECKENTRY' AND KSQL_COL_NAME IN ('FMATERIALNAMETEXT')) 
 ALTER TABLE T_PUR_CHECKENTRY ADD (FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INVOICENTRY2' AND KSQL_COL_NAME IN ('FMATERIALNAMETEXT')) 
 ALTER TABLE T_PUR_INVOICENTRY2 ADD (FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INVOICENTRY' AND KSQL_COL_NAME IN ('FMATERIALNAMETEXT')) 
 ALTER TABLE T_PUR_INVOICENTRY ADD (FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_ORDERCHECK' AND KSQL_COL_NAME IN ('FMATERIALNAMETEXT')) 
 ALTER TABLE T_PUR_ORDERCHECK ADD (FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_PAYAPPLYENTRY' AND KSQL_COL_NAME IN ('FMATERIALNAMETEXT')) 
 ALTER TABLE T_PUR_PAYAPPLYENTRY ADD (FMATERIALNAMETEXT NVARCHAR(255) DEFAULT ' ' NOT NULL );
 
/**End C:\PDM_UPGRADE\PDM1\PUR_table.sql **/