/**Begin C:\PDM_UPGRADE\PDM1\SRM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRM_AUTOEVATPL' AND KSQL_COL_NAME IN ('FCATEGORYVALUE')) 
 ALTER TABLE T_SRM_AUTOEVATPL ADD (FCATEGORYVALUE VARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRM_AUTOEVATPL' AND KSQL_COL_NAME IN ('FMATERIALVALUE')) 
 ALTER TABLE T_SRM_AUTOEVATPL ADD (FMATERIALVALUE VARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRM_AUTOEVATPLVER' AND KSQL_COL_NAME IN ('FCATEGORYVALUE')) 
 ALTER TABLE T_SRM_AUTOEVATPLVER ADD (FCATEGORYVALUE VARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRM_AUTOEVATPLVER' AND KSQL_COL_NAME IN ('FMATERIALVALUE')) 
 ALTER TABLE T_SRM_AUTOEVATPLVER ADD (FMATERIALVALUE VARCHAR(60) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRM_AUTOEVASUPENTRY') 
 CREATE TABLE T_SRM_AUTOEVASUPENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FEVASUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FEVACATEGORYID BIGINT DEFAULT 0 NOT NULL,
FEVAMATERIALID BIGINT DEFAULT 0 NOT NULL,
FEVASCHEMEID BIGINT DEFAULT 0 NOT NULL,
FEVAGRADEID BIGINT DEFAULT 0 NOT NULL,
FWEIGHTSTRATEGY VARCHAR(30) DEFAULT ' ' NOT NULL,
FEVASUPNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRM_AUTOEVASUPENTRYVER') 
 CREATE TABLE T_SRM_AUTOEVASUPENTRYVER (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FEVASUPPLIERID BIGINT DEFAULT 0 NOT NULL,
FSUPPLIERNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL,
FEVACATEGORYID BIGINT DEFAULT 0 NOT NULL,
FEVAMATERIALID BIGINT DEFAULT 0 NOT NULL,
FEVASCHEMEID BIGINT DEFAULT 0 NOT NULL,
FEVAGRADEID BIGINT DEFAULT 0 NOT NULL,
FWEIGHTSTRATEGY VARCHAR(30) DEFAULT ' ' NOT NULL,
FEVASUPNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRM_AUTOSCORERENTRY') 
 CREATE TABLE T_SRM_AUTOSCORERENTRY (
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FEVAINDEXCLASSID BIGINT DEFAULT 0 NOT NULL,
FEVASCORERID BIGINT DEFAULT 0 NOT NULL,
FEVASCORERWEIGHT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCORERNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRM_AUTOSCORERENTRYVER') 
 CREATE TABLE T_SRM_AUTOSCORERENTRYVER (
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FEVAINDEXCLASSID BIGINT DEFAULT 0 NOT NULL,
FEVASCORERID BIGINT DEFAULT 0 NOT NULL,
FEVASCORERWEIGHT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSCORERNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL
);



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