/**Begin D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_MDS_ORDERSETOFF') 
 CREATE TABLE T_MDS_ORDERSETOFF (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS VARCHAR(5) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FAUDITORID BIGINT DEFAULT 0 NOT NULL,
FAUDITDATE DATETIME,
FMODIFYTIME DATETIME,
FCREATETIME DATETIME,
FORDERNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FORDERID BIGINT DEFAULT 0 NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FOKDATE DATETIME,
FFINISHDATE DATETIME,
FFORDATE DATETIME,
FSETOFFDATE DATETIME,
FSETOFFVERID BIGINT DEFAULT 0 NOT NULL,
FORDERSEQ BIGINT DEFAULT 0 NOT NULL,
FORDERENTRYID BIGINT DEFAULT 0 NOT NULL,
FROWNO VARCHAR(50) DEFAULT ' ' NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FSETOFFQTY DECIMAL(23,10) DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_ORDERSETOFF' AND KSQL_COL_NAME ='FFORECASTQTY') 
 ALTER TABLE T_MDS_ORDERSETOFF ADD (FFORECASTQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );

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