/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\PUR_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_QUOTE' AND KSQL_COL_NAME ='FTOTALINQUIRY') 
 ALTER TABLE T_PUR_QUOTE ADD (FTOTALINQUIRY CHAR(1) DEFAULT '0' NOT NULL );
 EXEC p_AlterColumn 'T_PUR_BASEDATALINK', 'FSRCBASEDATA', 'NVARCHAR(100)', 'NOT NULL', '0001', ''' ''';

 EXEC p_AlterColumn 'T_PUR_BASEDATALINK', 'FDESTBASEDATA', 'NVARCHAR(100)', 'NOT NULL', '0001', ''' ''';

 EXEC p_AlterColumn 'T_PUR_BASEDATALINK', 'FBASEDATATYPE', 'NVARCHAR(100)', 'NOT NULL', '0001', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_EXAMINE_A' AND KSQL_COL_NAME ='FSRCBILLTYPE') 
 ALTER TABLE T_PUR_EXAMINE_A ADD (FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_EXAMINE_A' AND KSQL_COL_NAME ='FSRCBILLNO') 
 ALTER TABLE T_PUR_EXAMINE_A ADD (FSRCBILLNO VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_EXAMINE_A' AND KSQL_COL_NAME ='FSRCBILLID') 
 ALTER TABLE T_PUR_EXAMINE_A ADD (FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_IMPROVE_A' AND KSQL_COL_NAME ='FSRCBILLTYPE') 
 ALTER TABLE T_PUR_IMPROVE_A ADD (FSRCBILLTYPE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_IMPROVE_A' AND KSQL_COL_NAME ='FSRCBILLNO') 
 ALTER TABLE T_PUR_IMPROVE_A ADD (FSRCBILLNO VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_IMPROVE_A' AND KSQL_COL_NAME ='FSRCBILLID') 
 ALTER TABLE T_PUR_IMPROVE_A ADD (FSRCBILLID VARCHAR(50) DEFAULT ' ' NOT NULL );

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