/**Begin D:\PDM_UPGRADE\PDM1\TM_table.sql **/
 EXEC p_AlterColumn 'T_TM_OPTIONCOMB', 'FPV', 'DECIMAL(23,10)', 'NOT NULL', '0100', '0';

 EXEC p_AlterColumn 'T_TM_OPTIONCOMB', 'FDELTA', 'DECIMAL(23,10)', 'NOT NULL', '0100', '0';

 EXEC p_AlterColumn 'T_TM_OPTIONCOMB', 'FGAMMA', 'DECIMAL(23,10)', 'NOT NULL', '0100', '0';

 EXEC p_AlterColumn 'T_TM_OPTIONCOMB', 'FVEGA', 'DECIMAL(23,10)', 'NOT NULL', '0100', '0';

 EXEC p_AlterColumn 'T_TM_OPTIONCOMB', 'FTHETA', 'DECIMAL(23,10)', 'NOT NULL', '0100', '0';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_OPTIONCOMB' AND KSQL_COL_NAME IN ('FREQNO'))
 ALTER TABLE T_TM_OPTIONCOMB ADD (FREQNO NVARCHAR(80) DEFAULT ' ' NOT NULL );
 EXEC p_AlterColumn 'T_TM_OPTIONCOMB_ENTRY', 'FSTRIKEPRICE', 'DECIMAL(23,10)', 'NOT NULL', '0100', '0';

 EXEC p_AlterColumn 'T_TM_OPTIONCOMB_ENTRY', 'FNAMEAMT', 'DECIMAL(23,10)', 'NOT NULL', '0100', '0';

 EXEC p_AlterColumn 'T_TM_OPTIONCOMB_ENTRY', 'FPREMIUM', 'DECIMAL(23,10)', 'NOT NULL', '0100', '0';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_OPTIONCOMB_ENTRY' AND KSQL_COL_NAME IN ('FTRADENOID'))
 ALTER TABLE T_TM_OPTIONCOMB_ENTRY ADD (FTRADENOID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_OPTIONCOMB_ENTRY' AND KSQL_COL_NAME IN ('FBASEAMOUNT'))
 ALTER TABLE T_TM_OPTIONCOMB_ENTRY ADD (FBASEAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_OPTIONCOMB_ENTRY' AND KSQL_COL_NAME IN ('FSELLAMOUNT'))
 ALTER TABLE T_TM_OPTIONCOMB_ENTRY ADD (FSELLAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_OPTIONCOMB_ENTRY' AND KSQL_COL_NAME IN ('FBASECURRENCYID'))
 ALTER TABLE T_TM_OPTIONCOMB_ENTRY ADD (FBASECURRENCYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_OPTIONCOMB_ENTRY' AND KSQL_COL_NAME IN ('FSELLCURRENCYID'))
 ALTER TABLE T_TM_OPTIONCOMB_ENTRY ADD (FSELLCURRENCYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_OPTIONCOMB_ENTRY' AND KSQL_COL_NAME IN ('FPREMIUMCURRENCYID'))
 ALTER TABLE T_TM_OPTIONCOMB_ENTRY ADD (FPREMIUMCURRENCYID BIGINT DEFAULT 0 NOT NULL );
 --- drop column --------- 请认真检查该脚本 -------------------
 EXEC p_AlterColumn 'T_TM_OPTIONCOMB_ENTRY', 'FTRADENO', 'NULL', 'NULL', '1001', 'NULL';




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


/**Begin D:\PDM_UPGRADE\PDM1\TM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_COMBTRADE')
 CREATE TABLE T_TM_COMBTRADE (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLNO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FBILLSTATUS NVARCHAR(30) 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,
FNAME NVARCHAR(80) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_COMBTRADE_INFO')
 CREATE TABLE T_TM_COMBTRADE_INFO (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FTRADENO NVARCHAR(80) DEFAULT ' ' NOT NULL,
FTRADEBILLID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TM_COMBTRADE_ORG')
 CREATE TABLE T_TM_COMBTRADE_ORG (
FID BIGINT DEFAULT 0 NOT NULL,
FPKID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_TRADE' AND KSQL_COL_NAME IN ('FISHIS'))
 ALTER TABLE T_TM_TRADE ADD (FISHIS CHAR(1) DEFAULT '0' NOT NULL );


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TM_COMBTRADE_INFO' AND KSQL_COL_NAME IN ('FTRADEBILLENTITY'))
 ALTER TABLE T_TM_COMBTRADE_INFO ADD (FTRADEBILLENTITY NVARCHAR(80) DEFAULT ' ' NOT NULL );

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

