/**Begin D:\PDM_UPGRADE\PDM1\TM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_TRADE_L' AND KSQL_COL_NAME IN ('FVARIETY')) 
 ALTER TABLE T_TM_TRADE_L ADD (FVARIETY NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_TRADE' AND KSQL_COL_NAME IN ('FCATEGORY')) 
 ALTER TABLE T_TM_TRADE ADD (FCATEGORY NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_TRADE' AND KSQL_COL_NAME IN ('FVARIETY')) 
 ALTER TABLE T_TM_TRADE ADD (FVARIETY NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_TRADE' AND KSQL_COL_NAME IN ('FTYPE')) 
 ALTER TABLE T_TM_TRADE ADD (FTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_OPTIONCOMB' AND KSQL_COL_NAME IN ('FCATEGORY')) 
 ALTER TABLE T_TM_OPTIONCOMB ADD (FCATEGORY NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_OPTIONCOMB' AND KSQL_COL_NAME IN ('FVARIETY')) 
 ALTER TABLE T_TM_OPTIONCOMB ADD (FVARIETY NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_OPTIONCOMB' AND KSQL_COL_NAME IN ('FTYPE')) 
 ALTER TABLE T_TM_OPTIONCOMB ADD (FTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_COMBTRADE' AND KSQL_COL_NAME IN ('FCATEGORY')) 
 ALTER TABLE T_TM_COMBTRADE ADD (FCATEGORY NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_COMBTRADE' AND KSQL_COL_NAME IN ('FVARIETY')) 
 ALTER TABLE T_TM_COMBTRADE ADD (FVARIETY NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_COMBTRADE' AND KSQL_COL_NAME IN ('FTYPE')) 
 ALTER TABLE T_TM_COMBTRADE ADD (FTYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_OPTIONCOMB_L') 
 CREATE TABLE T_TM_OPTIONCOMB_L (
FPKID NVARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FVARIETY NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_COMBTRADE_L') 
 CREATE TABLE T_TM_COMBTRADE_L (
FPKID NVARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID NVARCHAR(10) DEFAULT ' ' NOT NULL,
FVARIETY NVARCHAR(255) DEFAULT ' ' NOT NULL
);



/**End D:\PDM_UPGRADE\PDM1\TM_table.sql **/
