/**Begin C:\PDM_UPGRADE\PDM1\SRC_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT' AND KSQL_COL_NAME IN ('FEXTFILTERID')) 
 ALTER TABLE T_SRC_PROJECT ADD (FEXTFILTERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT' AND KSQL_COL_NAME IN ('FDECISIONTYPE')) 
 ALTER TABLE T_SRC_PROJECT ADD (FDECISIONTYPE CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLISTENTRY' AND KSQL_COL_NAME IN ('FISDECISION')) 
 ALTER TABLE T_SRC_PURLISTENTRY ADD (FISDECISION CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PATTERN' AND KSQL_COL_NAME IN ('FISLARGEZERO')) 
 ALTER TABLE T_SRC_PATTERN ADD (FISLARGEZERO CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_TENDENCY') 
 CREATE TABLE T_SRC_TENDENCY (
FID BIGINT DEFAULT 0 NOT NULL,
FPROJECTID BIGINT DEFAULT 0 NOT NULL,
FPACKAGEID BIGINT DEFAULT 0 NOT NULL,
FPURLISTID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FORGID BIGINT DEFAULT 0 NOT NULL,
FTURNS VARCHAR(2) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FRANK INT DEFAULT 0 NOT NULL,
FSYSRESULT CHAR(1) DEFAULT ' ' NOT NULL,
FRESULT CHAR(1) DEFAULT ' ' NOT NULL,
FORDERRATIO DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCFMQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT 'A' NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAX DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCCURRID BIGINT DEFAULT 0 NOT NULL,
FLOCPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLOCTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FMAXTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUSDPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FBESTPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICE12 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICE13 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICE14 DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICE15 DECIMAL(23,10) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_DECISIONLIST') 
 CREATE TABLE T_SRC_DECISIONLIST (
FID BIGINT DEFAULT 0 NOT NULL,
FPARENTID VARCHAR(50) DEFAULT ' ' NOT NULL,
FORIGIN CHAR(1) DEFAULT ' ' NOT NULL,
FPENTITYKEY VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYKEY VARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_DECISIONLISTENTRY') 
 CREATE TABLE T_SRC_DECISIONLISTENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSRCENTRYID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_TENDENCY_L') 
 CREATE TABLE T_SRC_TENDENCY_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_DECISIONPURLIST') 
 CREATE TABLE T_SRC_DECISIONPURLIST (
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_DECISIONPACKAGE') 
 CREATE TABLE T_SRC_DECISIONPACKAGE (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);



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