/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SRC_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_ASSESSCONFIG' AND KSQL_COL_NAME ='FEXPERTCOUNT') 
 ALTER TABLE T_SRC_ASSESSCONFIG ADD (FEXPERTCOUNT INT DEFAULT 0 NOT NULL );
 EXEC p_AlterColumn 'T_SRC_PKGAMOUNT', 'FTURNS', 'VARCHAR(2)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_SRC_PRICECHGENTRY', 'FTURNS', 'VARCHAR(2)', 'NOT NULL', '1111', ''' ''';

 EXEC p_AlterColumn 'T_SRC_PROJECTPACKAGE', 'FTURNS', 'VARCHAR(2)', 'NOT NULL', '1111', ''' ''';

 EXEC p_AlterColumn 'T_SRC_PURREPORTSOURCE', 'FTURNS', 'VARCHAR(2)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_SRC_RATIOCHGENTRY', 'FTURNS', 'VARCHAR(2)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SCHEME' AND KSQL_COL_NAME ='FEXPERTCOUNT') 
 ALTER TABLE T_SRC_SCHEME ADD (FEXPERTCOUNT INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_APPLYENTRY' AND KSQL_COL_NAME ='FENTRYRCVORGID') 
 ALTER TABLE T_SRC_APPLYENTRY ADD (FENTRYRCVORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SCHEMEINDEX' AND KSQL_COL_NAME ='FSRCENTRYID') 
 ALTER TABLE T_SRC_SCHEMEINDEX ADD (FSRCENTRYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_MEMBERENTRY' AND KSQL_COL_NAME ='FISSIGNIN') 
 ALTER TABLE T_SRC_MEMBERENTRY ADD (FISSIGNIN CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_MEMBERENTRY' AND KSQL_COL_NAME ='FSIGNINTIME') 
 ALTER TABLE T_SRC_MEMBERENTRY ADD (FSIGNINTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_MEMBERENTRY' AND KSQL_COL_NAME ='FSRCENTRYID') 
 ALTER TABLE T_SRC_MEMBERENTRY ADD (FSRCENTRYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLISTENTRY_F' AND KSQL_COL_NAME ='FENTRYRCVORGID') 
 ALTER TABLE T_SRC_PURLISTENTRY_F ADD (FENTRYRCVORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLISTENTRY_F' AND KSQL_COL_NAME ='FISPRESENT') 
 ALTER TABLE T_SRC_PURLISTENTRY_F ADD (FISPRESENT CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLISTENTRY_F' AND KSQL_COL_NAME ='FROWTYPEID') 
 ALTER TABLE T_SRC_PURLISTENTRY_F ADD (FROWTYPEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLISTENTRY_F' AND KSQL_COL_NAME ='FBASEUNITID') 
 ALTER TABLE T_SRC_PURLISTENTRY_F ADD (FBASEUNITID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLISTENTRY_F' AND KSQL_COL_NAME ='FBASEQTY') 
 ALTER TABLE T_SRC_PURLISTENTRY_F ADD (FBASEQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLISTENTRY_F' AND KSQL_COL_NAME ='FDELIVERDATE') 
 ALTER TABLE T_SRC_PURLISTENTRY_F ADD (FDELIVERDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_O' AND KSQL_COL_NAME ='FISBIZSCORE') 
 ALTER TABLE T_SRC_PROJECT_O ADD (FISBIZSCORE CHAR(1) DEFAULT '0' NOT NULL );
 EXEC p_AlterColumn 'T_SRC_BIDDOCBILL', 'FTURNS', 'VARCHAR(2)', 'NOT NULL', '1111', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_CONTRACTENTRY' AND KSQL_COL_NAME ='FENTRYRCVORGID') 
 ALTER TABLE T_SRC_CONTRACTENTRY ADD (FENTRYRCVORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_NOTYEARINFO' AND KSQL_COL_NAME ='FENTRYRCVORGID') 
 ALTER TABLE T_SRC_NOTYEARINFO ADD (FENTRYRCVORGID BIGINT DEFAULT 0 NOT NULL );
 EXEC p_AlterColumn 'T_SRC_VIE_TURNS', 'FTURNS', 'VARCHAR(2)', 'NOT NULL', '1111', ''' ''';

 EXEC p_AlterColumn 'T_SRC_VIE_TURNS', 'FVIETURNS', 'VARCHAR(2)', 'NOT NULL', '1111', ''' ''';

 EXEC p_AlterColumn 'T_SRC_DECISIONCHGENTRY', 'FTURNS', 'VARCHAR(2)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_SRC_QUOTEBILL', 'FVIETURNS', 'VARCHAR(2)', 'NOT NULL', '1111', '''1''';

 EXEC p_AlterColumn 'T_SRC_VIE_DETAIL', 'FTURNS', 'VARCHAR(2)', 'NOT NULL', '1111', ''' ''';

 EXEC p_AlterColumn 'T_SRC_VIE_DETAIL', 'FVIETURNS', 'VARCHAR(2)', 'NOT NULL', '1111', ''' ''';


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