/**Begin C:\PDM_UPGRADE\PDM1\PUR_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_PAYAPPLY' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_PAYAPPLY ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_PAYAPPLY' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_PAYAPPLY ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_PAY' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_PAY ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_PAY' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_PAY ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_SALOUTSTOCK' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_SALOUTSTOCK ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_SALOUTSTOCK' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_SALOUTSTOCK ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_ORDCHANGE' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_ORDCHANGE ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_ORDCHANGE' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_ORDCHANGE ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_ORDER' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_ORDER ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_ORDER' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_ORDER ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_COMPARE' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_COMPARE ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_COMPARE' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_COMPARE ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_REQUEST' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_REQUEST ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_REQUEST' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_REQUEST ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INQUIRY' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_INQUIRY ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INQUIRY' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_INQUIRY ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_QUOTE' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_QUOTE ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_QUOTE' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_QUOTE ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INSTOCK' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_INSTOCK ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INSTOCK' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_INSTOCK ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INVOICE' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_INVOICE ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_INVOICE' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_INVOICE ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_RETURN' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_RETURN ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_RETURN' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_RETURN ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_RECEIPT' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_RECEIPT ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_RECEIPT' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_RECEIPT ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_CHECK' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_CHECK ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_CHECK' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_CHECK ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_NOTICE' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_NOTICE ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_NOTICE' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_NOTICE ADD (FLASTUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_BIDBILL' AND KSQL_COL_NAME IN ('FLASTUPDATEUSERID')) 
 ALTER TABLE T_PUR_BIDBILL ADD (FLASTUPDATEUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_BIDBILL' AND KSQL_COL_NAME IN ('FLASTUPDATETIME')) 
 ALTER TABLE T_PUR_BIDBILL ADD (FLASTUPDATETIME DATETIME );




/**End C:\PDM_UPGRADE\PDM1\PUR_table.sql **/
