/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SRC_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_SUPPLIERUSER') 
 CREATE TABLE T_SRC_SUPPLIERUSER (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_SUPPLIERUSERS') 
 CREATE TABLE T_SRC_SUPPLIERUSERS (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


 EXEC p_AlterColumn 'T_SRC_INDEXENTRY', 'FITEM', 'NVARCHAR(1020)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_A' AND KSQL_COL_NAME ='FISBIDNOTICE') 
 ALTER TABLE T_SRC_PROJECT_A ADD (FISBIDNOTICE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_A' AND KSQL_COL_NAME ='FISENDNOTICE') 
 ALTER TABLE T_SRC_PROJECT_A ADD (FISENDNOTICE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_A' AND KSQL_COL_NAME ='FSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_A ADD (FSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_A' AND KSQL_COL_NAME ='FSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_A ADD (FSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_A' AND KSQL_COL_NAME ='FUNSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_A ADD (FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_A' AND KSQL_COL_NAME ='FUNSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_A ADD (FUNSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_A' AND KSQL_COL_NAME ='FUNAUDITORID') 
 ALTER TABLE T_SRC_PROJECT_A ADD (FUNAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_A' AND KSQL_COL_NAME ='FUNAUDITDATE') 
 ALTER TABLE T_SRC_PROJECT_A ADD (FUNAUDITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_E' AND KSQL_COL_NAME ='FSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_E ADD (FSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_E' AND KSQL_COL_NAME ='FSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_E ADD (FSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_E' AND KSQL_COL_NAME ='FUNSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_E ADD (FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_E' AND KSQL_COL_NAME ='FUNSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_E ADD (FUNSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_E' AND KSQL_COL_NAME ='FUNAUDITORID') 
 ALTER TABLE T_SRC_PROJECT_E ADD (FUNAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_E' AND KSQL_COL_NAME ='FUNAUDITDATE') 
 ALTER TABLE T_SRC_PROJECT_E ADD (FUNAUDITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_F' AND KSQL_COL_NAME ='FSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_F ADD (FSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_F' AND KSQL_COL_NAME ='FSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_F ADD (FSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_F' AND KSQL_COL_NAME ='FUNSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_F ADD (FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_F' AND KSQL_COL_NAME ='FUNSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_F ADD (FUNSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_F' AND KSQL_COL_NAME ='FUNAUDITORID') 
 ALTER TABLE T_SRC_PROJECT_F ADD (FUNAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_F' AND KSQL_COL_NAME ='FUNAUDITDATE') 
 ALTER TABLE T_SRC_PROJECT_F ADD (FUNAUDITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_H' AND KSQL_COL_NAME ='FSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_H ADD (FSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_H' AND KSQL_COL_NAME ='FSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_H ADD (FSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_H' AND KSQL_COL_NAME ='FUNSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_H ADD (FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_H' AND KSQL_COL_NAME ='FUNSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_H ADD (FUNSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_H' AND KSQL_COL_NAME ='FUNAUDITORID') 
 ALTER TABLE T_SRC_PROJECT_H ADD (FUNAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_H' AND KSQL_COL_NAME ='FUNAUDITDATE') 
 ALTER TABLE T_SRC_PROJECT_H ADD (FUNAUDITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_J' AND KSQL_COL_NAME ='FSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_J ADD (FSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_J' AND KSQL_COL_NAME ='FSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_J ADD (FSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_J' AND KSQL_COL_NAME ='FUNSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_J ADD (FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_J' AND KSQL_COL_NAME ='FUNSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_J ADD (FUNSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_J' AND KSQL_COL_NAME ='FUNAUDITORID') 
 ALTER TABLE T_SRC_PROJECT_J ADD (FUNAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_J' AND KSQL_COL_NAME ='FUNAUDITDATE') 
 ALTER TABLE T_SRC_PROJECT_J ADD (FUNAUDITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_K' AND KSQL_COL_NAME ='FSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_K ADD (FSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_K' AND KSQL_COL_NAME ='FSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_K ADD (FSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_K' AND KSQL_COL_NAME ='FUNSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_K ADD (FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_K' AND KSQL_COL_NAME ='FUNSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_K ADD (FUNSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_K' AND KSQL_COL_NAME ='FUNAUDITORID') 
 ALTER TABLE T_SRC_PROJECT_K ADD (FUNAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_K' AND KSQL_COL_NAME ='FUNAUDITDATE') 
 ALTER TABLE T_SRC_PROJECT_K ADD (FUNAUDITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_P' AND KSQL_COL_NAME ='FSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_P ADD (FSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_P' AND KSQL_COL_NAME ='FSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_P ADD (FSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_P' AND KSQL_COL_NAME ='FUNSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_P ADD (FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_P' AND KSQL_COL_NAME ='FUNSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_P ADD (FUNSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_P' AND KSQL_COL_NAME ='FUNAUDITORID') 
 ALTER TABLE T_SRC_PROJECT_P ADD (FUNAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_P' AND KSQL_COL_NAME ='FUNAUDITDATE') 
 ALTER TABLE T_SRC_PROJECT_P ADD (FUNAUDITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Q' AND KSQL_COL_NAME ='FSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_Q ADD (FSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Q' AND KSQL_COL_NAME ='FSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_Q ADD (FSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Q' AND KSQL_COL_NAME ='FUNSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_Q ADD (FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Q' AND KSQL_COL_NAME ='FUNSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_Q ADD (FUNSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Q' AND KSQL_COL_NAME ='FUNAUDITORID') 
 ALTER TABLE T_SRC_PROJECT_Q ADD (FUNAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Q' AND KSQL_COL_NAME ='FUNAUDITDATE') 
 ALTER TABLE T_SRC_PROJECT_Q ADD (FUNAUDITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_T' AND KSQL_COL_NAME ='FISWINNOTICE') 
 ALTER TABLE T_SRC_PROJECT_T ADD (FISWINNOTICE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_T' AND KSQL_COL_NAME ='FISENDNOTICE') 
 ALTER TABLE T_SRC_PROJECT_T ADD (FISENDNOTICE CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_T' AND KSQL_COL_NAME ='FSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_T ADD (FSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_T' AND KSQL_COL_NAME ='FSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_T ADD (FSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_T' AND KSQL_COL_NAME ='FUNSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_T ADD (FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_T' AND KSQL_COL_NAME ='FUNSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_T ADD (FUNSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_T' AND KSQL_COL_NAME ='FUNAUDITORID') 
 ALTER TABLE T_SRC_PROJECT_T ADD (FUNAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_T' AND KSQL_COL_NAME ='FUNAUDITDATE') 
 ALTER TABLE T_SRC_PROJECT_T ADD (FUNAUDITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Z' AND KSQL_COL_NAME ='FSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_Z ADD (FSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Z' AND KSQL_COL_NAME ='FSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_Z ADD (FSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Z' AND KSQL_COL_NAME ='FUNSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_Z ADD (FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Z' AND KSQL_COL_NAME ='FUNSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_Z ADD (FUNSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Z' AND KSQL_COL_NAME ='FUNAUDITORID') 
 ALTER TABLE T_SRC_PROJECT_Z ADD (FUNAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Z' AND KSQL_COL_NAME ='FUNAUDITDATE') 
 ALTER TABLE T_SRC_PROJECT_Z ADD (FUNAUDITDATE DATETIME );
 EXEC p_AlterColumn 'T_SRC_SCOREENTRY', 'FINDEXRULE', 'NVARCHAR(1020)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_INVITESUPPLIER_TEMP' AND KSQL_COL_NAME ='FPUBLISHERID') 
 ALTER TABLE T_SRC_INVITESUPPLIER_TEMP ADD (FPUBLISHERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_INVITESUPPLIER_TEMP' AND KSQL_COL_NAME ='FPUBLISHSTATUS') 
 ALTER TABLE T_SRC_INVITESUPPLIER_TEMP ADD (FPUBLISHSTATUS CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_INVITESUPPLIER_TEMP' AND KSQL_COL_NAME ='FPUBLISHDATE') 
 ALTER TABLE T_SRC_INVITESUPPLIER_TEMP ADD (FPUBLISHDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_B' AND KSQL_COL_NAME ='FSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_B ADD (FSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_B' AND KSQL_COL_NAME ='FSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_B ADD (FSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_B' AND KSQL_COL_NAME ='FUNSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_B ADD (FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_B' AND KSQL_COL_NAME ='FUNSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_B ADD (FUNSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_B' AND KSQL_COL_NAME ='FUNAUDITORID') 
 ALTER TABLE T_SRC_PROJECT_B ADD (FUNAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_B' AND KSQL_COL_NAME ='FUNAUDITDATE') 
 ALTER TABLE T_SRC_PROJECT_B ADD (FUNAUDITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT' AND KSQL_COL_NAME ='FSUPPLIERTYPE') 
 ALTER TABLE T_SRC_PROJECT ADD (FSUPPLIERTYPE VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT' AND KSQL_COL_NAME ='FSUPPLIERID') 
 ALTER TABLE T_SRC_PROJECT ADD (FSUPPLIERID BIGINT DEFAULT 0 NOT NULL );
 EXEC p_AlterColumn 'T_SRC_SCHEMEINDEX', 'FINDEXRULE', 'NVARCHAR(1020)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_O' AND KSQL_COL_NAME ='FSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_O ADD (FSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_O' AND KSQL_COL_NAME ='FSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_O ADD (FSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_O' AND KSQL_COL_NAME ='FUNSUBMITTERID') 
 ALTER TABLE T_SRC_PROJECT_O ADD (FUNSUBMITTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_O' AND KSQL_COL_NAME ='FUNSUBMITDATE') 
 ALTER TABLE T_SRC_PROJECT_O ADD (FUNSUBMITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_O' AND KSQL_COL_NAME ='FUNAUDITORID') 
 ALTER TABLE T_SRC_PROJECT_O ADD (FUNAUDITORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_O' AND KSQL_COL_NAME ='FUNAUDITDATE') 
 ALTER TABLE T_SRC_PROJECT_O ADD (FUNAUDITDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PATTERN' AND KSQL_COL_NAME ='FSOURCEDATAID') 
 ALTER TABLE T_SRC_PATTERN ADD (FSOURCEDATAID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PATTERN' AND KSQL_COL_NAME ='FBITINDEX') 
 ALTER TABLE T_SRC_PATTERN ADD (FBITINDEX INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PATTERN' AND KSQL_COL_NAME ='FSOURCEBITINDEX') 
 ALTER TABLE T_SRC_PATTERN ADD (FSOURCEBITINDEX INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SCHEME' AND KSQL_COL_NAME ='FSOURCEDATAID') 
 ALTER TABLE T_SRC_SCHEME ADD (FSOURCEDATAID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SCHEME' AND KSQL_COL_NAME ='FBITINDEX') 
 ALTER TABLE T_SRC_SCHEME ADD (FBITINDEX INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SCHEME' AND KSQL_COL_NAME ='FSOURCEBITINDEX') 
 ALTER TABLE T_SRC_SCHEME ADD (FSOURCEBITINDEX INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_BIDDOCBILL' AND KSQL_COL_NAME ='FISNOTICE') 
 ALTER TABLE T_SRC_BIDDOCBILL ADD (FISNOTICE CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_QUOTEBILL' AND KSQL_COL_NAME ='FISNOTICE') 
 ALTER TABLE T_SRC_QUOTEBILL ADD (FISNOTICE CHAR(1) DEFAULT ' ' NOT NULL );

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