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

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_DPSVRDSSET' AND KSQL_COL_NAME ='FPRODUCTFAMILY')
 ALTER TABLE T_MDS_DPSVRDSSET ADD (FPRODUCTFAMILY CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_DPSVRDSSET' AND KSQL_COL_NAME ='FDELIVERYRADIOGROUP')
 ALTER TABLE T_MDS_DPSVRDSSET ADD (FDELIVERYRADIOGROUP VARCHAR(5) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_DPSVRDSSET' AND KSQL_COL_NAME ='FSTOCKRADIOGROUP')
 ALTER TABLE T_MDS_DPSVRDSSET ADD (FSTOCKRADIOGROUP VARCHAR(5) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_DPSVRDSSET' AND KSQL_COL_NAME ='FWORKORDERRADIOGROUP')
 ALTER TABLE T_MDS_DPSVRDSSET ADD (FWORKORDERRADIOGROUP VARCHAR(5) DEFAULT ' ' NOT NULL );


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_DSPDELIVERY')
 CREATE TABLE T_MDS_DSPDELIVERY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FBILLTYPE VARCHAR(5) DEFAULT ' ' NOT NULL,
FBIZTYPE BIGINT DEFAULT 0 NOT NULL,
FINVSCHEME BIGINT DEFAULT 0 NOT NULL,
FTRANSTYPE VARCHAR(5) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_DSPSTOCKSET')
 CREATE TABLE T_MDS_DSPSTOCKSET (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSTOCKORGLD BIGINT DEFAULT 0 NOT NULL,
FSTOCKNUMBERID BIGINT DEFAULT 0 NOT NULL,
FSTOCKINDEXLD BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_DSPSTOCKSTATUS')
 CREATE TABLE T_MDS_DSPSTOCKSTATUS (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSTOCKSTATUSLD BIGINT DEFAULT 0 NOT NULL,
FSTOCKSTATUSFLAG CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_DSPSTOCKTYPE')
 CREATE TABLE T_MDS_DSPSTOCKTYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FSTOCKTYPELD BIGINT DEFAULT 0 NOT NULL,
FSTOCKTYPEFLAG CHAR(1) DEFAULT '0' NOT NULL
);


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



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