/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\GMC_table.sql **/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FMINPACKNUM') 
 ALTER TABLE T_MDR_ITEM ADD (FMINPACKNUM DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FISONSELL') 
 ALTER TABLE T_MDR_ITEM ADD (FISONSELL CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FNEWSELL') 
 ALTER TABLE T_MDR_ITEM ADD (FNEWSELL CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FONLYNOW') 
 ALTER TABLE T_MDR_ITEM ADD (FONLYNOW CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FSTOPPRODUCE') 
 ALTER TABLE T_MDR_ITEM ADD (FSTOPPRODUCE CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FRECOMMEND') 
 ALTER TABLE T_MDR_ITEM ADD (FRECOMMEND CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FNONSINGLE') 
 ALTER TABLE T_MDR_ITEM ADD (FNONSINGLE CHAR(1) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FITEMCLASSID') 
 ALTER TABLE T_MDR_ITEM ADD (FITEMCLASSID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FREFERENCEPRICE') 
 ALTER TABLE T_MDR_ITEM ADD (FREFERENCEPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FSELLTIME') 
 ALTER TABLE T_MDR_ITEM ADD (FSELLTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FCREATORID') 
 ALTER TABLE T_MDR_ITEM ADD (FCREATORID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FMODIFIERID') 
 ALTER TABLE T_MDR_ITEM ADD (FMODIFIERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FCREATETIME') 
 ALTER TABLE T_MDR_ITEM ADD (FCREATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FMODIFYTIME') 
 ALTER TABLE T_MDR_ITEM ADD (FMODIFYTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FNEWSELLTIME') 
 ALTER TABLE T_MDR_ITEM ADD (FNEWSELLTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FUPDATETIME') 
 ALTER TABLE T_MDR_ITEM ADD (FUPDATETIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FISPROMOTIONAL') 
 ALTER TABLE T_MDR_ITEM ADD (FISPROMOTIONAL CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FCURRENCY') 
 ALTER TABLE T_MDR_ITEM ADD (FCURRENCY BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FISASSISTORDER') 
 ALTER TABLE T_MDR_ITEM ADD (FISASSISTORDER CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FNOSELLTIME') 
 ALTER TABLE T_MDR_ITEM ADD (FNOSELLTIME DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FVOLUME') 
 ALTER TABLE T_MDR_ITEM ADD (FVOLUME DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEM' AND KSQL_COL_NAME ='FNETWEIGHT') 
 ALTER TABLE T_MDR_ITEM ADD (FNETWEIGHT DECIMAL(23,10) DEFAULT 0 NOT NULL );

/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\GMC_table.sql **/
