/**Begin D:\PDM_UPGRADE\PDM1\IM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVADVICEENTRY' AND KSQL_COL_NAME ='FPUSHSTATUS') 
 ALTER TABLE T_IM_INVADVICEENTRY ADD (FPUSHSTATUS CHAR(1) DEFAULT 'A' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_BALINV_MATCHDETAIL' AND KSQL_COL_NAME ='FCOMFIRMSTATUS') 
 ALTER TABLE T_IM_BALINV_MATCHDETAIL ADD (FCOMFIRMSTATUS CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_BALINV_MATCHDETAIL' AND KSQL_COL_NAME ='FISHISTORY') 
 ALTER TABLE T_IM_BALINV_MATCHDETAIL ADD (FISHISTORY CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_BALINV_DETAILENTRY' AND KSQL_COL_NAME ='FADVICETYPE') 
 ALTER TABLE T_IM_BALINV_DETAILENTRY ADD (FADVICETYPE NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_BALINV_DETAILENTRY' AND KSQL_COL_NAME ='FRESERVEID') 
 ALTER TABLE T_IM_BALINV_DETAILENTRY ADD (FRESERVEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_IM_INV_WORKBENCHLOG') 
 CREATE TABLE T_IM_INV_WORKBENCHLOG (
FID BIGINT DEFAULT 0 NOT NULL,
FUSERID BIGINT DEFAULT 0 NOT NULL,
FBALANCEORGID BIGINT DEFAULT 0 NOT NULL,
FSCHEMEID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFYDATE DATETIME,
FCALNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSTEP CHAR(1) DEFAULT 'A' NOT NULL
);



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