/**Begin C:\PDM_UPGRADE\PDM1\SRC_table.sql **/
 EXEC p_AlterColumn 'T_SRC_PROJECT', 'FDECISIONTYPE', 'CHAR(1)', 'NOT NULL', '0001', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_APPLYENTRY' AND KSQL_COL_NAME IN ('FDEMANDQTY')) 
 ALTER TABLE T_SRC_APPLYENTRY ADD (FDEMANDQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLIST' AND KSQL_COL_NAME IN ('FDECISIONTYPE')) 
 ALTER TABLE T_SRC_PURLIST ADD (FDECISIONTYPE CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FRANK')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FRANK INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FCFMQTY')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FCFMQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FCFMQTYNEW')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FCFMQTYNEW DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FPRICE')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FPRICENEW')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FPRICENEW DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FTAXPRICE')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FTAXPRICENEW')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FTAXPRICENEW DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FAMOUNTNEW')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FAMOUNTNEW DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FTAXAMOUNTNEW')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FTAXAMOUNTNEW DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FCURRENCY')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FCURRENCY BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FQTY')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FQTYNEW')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FQTYNEW DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FUNITID')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FUNITID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FTAXITEMID')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FTAXITEMID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FTAXITEMNEW')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FTAXITEMNEW BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FTAXRATE')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_DECISIONCHGENTRY' AND KSQL_COL_NAME IN ('FTAXRATENEW')) 
 ALTER TABLE T_SRC_DECISIONCHGENTRY ADD (FTAXRATENEW DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_A' AND KSQL_COL_NAME IN ('FISNEEDINVITE')) 
 ALTER TABLE T_SRC_PROJECT_A ADD (FISNEEDINVITE CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Q' AND KSQL_COL_NAME IN ('FBASESCORE')) 
 ALTER TABLE T_SRC_PROJECT_Q ADD (FBASESCORE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_Q' AND KSQL_COL_NAME IN ('FMINSCORE')) 
 ALTER TABLE T_SRC_PROJECT_Q ADD (FMINSCORE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_T' AND KSQL_COL_NAME IN ('FISNEEDINVITE')) 
 ALTER TABLE T_SRC_PROJECT_T ADD (FISNEEDINVITE CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_T' AND KSQL_COL_NAME IN ('FISNEEDINVITE2')) 
 ALTER TABLE T_SRC_PROJECT_T ADD (FISNEEDINVITE2 CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_INDEXENTRY' AND KSQL_COL_NAME IN ('FITEMMINSCORE')) 
 ALTER TABLE T_SRC_INDEXENTRY ADD (FITEMMINSCORE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_INDEXENTRY' AND KSQL_COL_NAME IN ('FITEMMAXSCORE')) 
 ALTER TABLE T_SRC_INDEXENTRY ADD (FITEMMAXSCORE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PATTERN' AND KSQL_COL_NAME IN ('FBASESCORERATIO')) 
 ALTER TABLE T_SRC_PATTERN ADD (FBASESCORERATIO DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PATTERN' AND KSQL_COL_NAME IN ('FMINSCORERATIO')) 
 ALTER TABLE T_SRC_PATTERN ADD (FMINSCORERATIO DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SCHEMEINDEX' AND KSQL_COL_NAME IN ('FSRCINDEXLIBID')) 
 ALTER TABLE T_SRC_SCHEMEINDEX ADD (FSRCINDEXLIBID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SCHEMERULE' AND KSQL_COL_NAME IN ('FITEMMINSCORE')) 
 ALTER TABLE T_SRC_SCHEMERULE ADD (FITEMMINSCORE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SCHEMERULE' AND KSQL_COL_NAME IN ('FITEMMAXSCORE')) 
 ALTER TABLE T_SRC_SCHEMERULE ADD (FITEMMAXSCORE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_EXT' AND KSQL_COL_NAME IN ('FDECISIONTYPE')) 
 ALTER TABLE T_SRC_PROJECT_EXT ADD (FDECISIONTYPE CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_EXT_A' AND KSQL_COL_NAME IN ('FPROJECTCREATORID')) 
 ALTER TABLE T_SRC_PROJECT_EXT_A ADD (FPROJECTCREATORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_EXT_A' AND KSQL_COL_NAME IN ('FPROJECTCREATETIME')) 
 ALTER TABLE T_SRC_PROJECT_EXT_A ADD (FPROJECTCREATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_TENDENCY' AND KSQL_COL_NAME IN ('FPRICE2')) 
 ALTER TABLE T_SRC_TENDENCY ADD (FPRICE2 DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_TENDENCY' AND KSQL_COL_NAME IN ('FPRICE3')) 
 ALTER TABLE T_SRC_TENDENCY ADD (FPRICE3 DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_ENTRYSCORER') 
 CREATE TABLE T_SRC_ENTRYSCORER (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_EXTENDPARAM') 
 CREATE TABLE T_SRC_EXTENDPARAM (
FID BIGINT DEFAULT 0 NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FPARAMVALUE NVARCHAR(510) DEFAULT ' ' NOT NULL,
FPARAMETERID BIGINT DEFAULT 0 NOT NULL
);



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