/**Begin D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_PROBABILITYHP_LOG') 
 CREATE TABLE T_MDS_PROBABILITYHP_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FHPSELECTFILTER NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FHPSELECTFILTERVAL NCLOB,
FHPSELECTALL CHAR(1) DEFAULT '0' NOT NULL,
FHPDATASELECTNUM BIGINT DEFAULT 0 NOT NULL,
FHPSELECTDIMENSION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FHPSELECTDIMENSIONVAL NVARCHAR(255) DEFAULT ' ' NOT NULL,
FHPSORT NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FHPSORTVAL NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_PROBABILITYLOG') 
 CREATE TABLE T_MDS_PROBABILITYLOG (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FENABLE VARCHAR(5) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FPROBABILITYCALDEF BIGINT DEFAULT 0 NOT NULL,
FCOMMONGROUP NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSAMPLEDATA BIGINT DEFAULT 0 NOT NULL,
FHISTORYDATA BIGINT DEFAULT 0 NOT NULL,
FSAMPLEHISTORYFILTER NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FSAMPLEHISTORYFILTERVAL NCLOB,
FALGORITHMDEF BIGINT DEFAULT 0 NOT NULL,
FCALSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FCREATEORG BIGINT DEFAULT 0 NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_PROBABILITYRESULT' AND KSQL_COL_NAME ='FLIFECONTROL') 
 ALTER TABLE T_MDS_PROBABILITYRESULT ADD (FLIFECONTROL CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_PROBABILITYRESULT' AND KSQL_COL_NAME ='FCONTRACTTYPE') 
 ALTER TABLE T_MDS_PROBABILITYRESULT ADD (FCONTRACTTYPE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_PROBABILITYRP_LOG') 
 CREATE TABLE T_MDS_PROBABILITYRP_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FRPSELECTFILTER NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FRPSELECTFILTERVAL NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_PROBABILITYSP_LOG') 
 CREATE TABLE T_MDS_PROBABILITYSP_LOG (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSPSELECTFILTER NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FSPSELECTFILTERVAL NCLOB,
FSPSELECTALL CHAR(1) DEFAULT '0' NOT NULL,
FSPDATASELECTNUM BIGINT DEFAULT 0 NOT NULL,
FSPSELECTDIMENSION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSPSELECTDIMENSIONVAL NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSPSORT NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FSPSORTVAL NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_PROBALOG_ACTYPE') 
 CREATE TABLE T_MDS_PROBALOG_ACTYPE (
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_MDS_PROBALOG_CARD') 
 CREATE TABLE T_MDS_PROBALOG_CARD (
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_MDS_PROBALOG_CARDTYPE') 
 CREATE TABLE T_MDS_PROBALOG_CARDTYPE (
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_MDS_PROBALOG_CHECKTYPE') 
 CREATE TABLE T_MDS_PROBALOG_CHECKTYPE (
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_MDS_PROBALOG_CUSTOMER') 
 CREATE TABLE T_MDS_PROBALOG_CUSTOMER (
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_MDS_PROBALOG_PROSTATE') 
 CREATE TABLE T_MDS_PROBALOG_PROSTATE (
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_MDS_SAMPLERELUSE') 
 CREATE TABLE T_MDS_SAMPLERELUSE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(80) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(5) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSAMPLECOMPARE VARCHAR(50) DEFAULT ' ' NOT NULL,
FSAMPLECOUNT BIGINT DEFAULT 0 NOT NULL,
FPROBABILITYCOMPARE VARCHAR(50) DEFAULT ' ' NOT NULL,
FPROBABILITY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FLEVELCOMPARE VARCHAR(50) DEFAULT ' ' NOT NULL,
FLEVELRATE BIGINT DEFAULT 0 NOT NULL,
FLEVEL VARCHAR(50) DEFAULT ' ' NOT NULL
);



/**End D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_table.sql **/
