/**Begin C:\PDM_UPGRADE\PDM1\SRC_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLIST' AND KSQL_COL_NAME IN ('FPICKSCHEMELD')) 
 ALTER TABLE T_SRC_PURLIST ADD (FPICKSCHEMELD BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLIST' AND KSQL_COL_NAME IN ('FEXPERTCOUNT')) 
 ALTER TABLE T_SRC_PURLIST ADD (FEXPERTCOUNT 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 IN ('FPICKSCHEMELD')) 
 ALTER TABLE T_SRC_PROJECT_F ADD (FPICKSCHEMELD 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 IN ('FEXPERTCOUNT')) 
 ALTER TABLE T_SRC_PROJECT_F ADD (FEXPERTCOUNT BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_SUPPLIERPICK') 
 CREATE TABLE T_SRC_SUPPLIERPICK (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(300) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT 'C' NOT NULL,
FENABLE CHAR(1) DEFAULT '1' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FMATCHFIELD INT DEFAULT 0 NOT NULL,
FISV_ID VARCHAR(50) DEFAULT ' ' NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FINVITETYPE CHAR(1) DEFAULT '1' NOT NULL,
FEXPERTCOUNT INT DEFAULT 0 NOT NULL,
FISUNINVITE CHAR(1) DEFAULT '1' NOT NULL,
FISALLSUPPLIER CHAR(1) DEFAULT '1' NOT NULL,
FISADD CHAR(1) DEFAULT '1' NOT NULL,
FISAUTOREFRESH CHAR(1) DEFAULT '1' NOT NULL,
FPRIORITY INT DEFAULT 0 NOT NULL,
FISOPENMODEL CHAR(1) DEFAULT '0' NOT NULL,
FCATEGORYLEVEL INT DEFAULT 0 NOT NULL,
FPURORGLEVEL CHAR(1) DEFAULT '2' NOT NULL,
FISALLCATEGORY CHAR(1) DEFAULT '1' NOT NULL,
FISACCURATE CHAR(1) DEFAULT '0' NOT NULL
);


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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_SUPPLIERPICKFLOW') 
 CREATE TABLE T_SRC_SUPPLIERPICKFLOW (
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_SUPPLIERPICKTYPE') 
 CREATE TABLE T_SRC_SUPPLIERPICKTYPE (
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_SUPPLIERPICKORG') 
 CREATE TABLE T_SRC_SUPPLIERPICKORG (
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_SUPPLIERPICKENTRY') 
 CREATE TABLE T_SRC_SUPPLIERPICKENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSCHEMELD BIGINT DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL
);



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