/**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_INQUIRY_A' AND KSQL_COL_NAME ='FSUPPLIERPROSTATUS') 
 ALTER TABLE T_PUR_INQUIRY_A ADD (FSUPPLIERPROSTATUS CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INQUIRYTURNSLOG' AND KSQL_COL_NAME ='FLOGDEADLINE') 
 ALTER TABLE T_PUR_INQUIRYTURNSLOG ADD (FLOGDEADLINE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INQUIRYTURNSLOG' AND KSQL_COL_NAME ='FENTRYLOGSCOPE') 
 ALTER TABLE T_PUR_INQUIRYTURNSLOG ADD (FENTRYLOGSCOPE CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_QUOTE' AND KSQL_COL_NAME ='FTURNSCOUNT') 
 ALTER TABLE T_PUR_QUOTE ADD (FTURNSCOUNT CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_ORDERENTRY_A' AND KSQL_COL_NAME ='FROWCLOSEID') 
 ALTER TABLE T_PUR_ORDERENTRY_A ADD (FROWCLOSEID BIGINT DEFAULT 0 NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_THIRDDATA' AND KSQL_COL_NAME ='FSOURCE') 
 ALTER TABLE T_PUR_THIRDDATA ADD (FSOURCE NVARCHAR(10) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INQUIRYSUPPLIER' AND KSQL_COL_NAME ='FSUPPLIERBIZSTATUS') 
 ALTER TABLE T_PUR_INQUIRYSUPPLIER ADD (FSUPPLIERBIZSTATUS CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INQUIRYSUPPLIER' AND KSQL_COL_NAME ='FENTRYTURNS') 
 ALTER TABLE T_PUR_INQUIRYSUPPLIER ADD (FENTRYTURNS CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INQUIRYSUPPLIER' AND KSQL_COL_NAME ='FENTRYCOUNT') 
 ALTER TABLE T_PUR_INQUIRYSUPPLIER ADD (FENTRYCOUNT CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INQUIRYSUPPLIER' AND KSQL_COL_NAME ='FCANSHOW') 
 ALTER TABLE T_PUR_INQUIRYSUPPLIER ADD (FCANSHOW CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INQUIRYSUPPLIER' AND KSQL_COL_NAME ='FDEADLINE') 
 ALTER TABLE T_PUR_INQUIRYSUPPLIER ADD (FDEADLINE DATETIME );

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