/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\IM_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_INVBILL ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_BILLFIELDSETTING' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_IM_BILLFIELDSETTING ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTSCHEME' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_INVCOUNTSCHEME ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVCOUNTBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_INVCOUNTBILL ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSAPPLY' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_TRANSAPPLY ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INITBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_INITBILL ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSOUTBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_TRANSOUTBILL ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSINBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_TRANSINBILL ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_ADJUSTBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_ADJUSTBILL ADD (FCOMMENT NVARCHAR(510) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_ASSEMBBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_ASSEMBBILL ADD (FCOMMENT NVARCHAR(510) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_LOCATIONTRANSFER' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_LOCATIONTRANSFER ADD (FCOMMENT NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_LOCATIONTRANSFER' AND KSQL_COL_NAME ='FTRANSFERCAUSE') 
 ALTER TABLE T_IM_LOCATIONTRANSFER ADD (FTRANSFERCAUSE NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_SALOUTBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_SALOUTBILL ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURINBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_PURINBILL ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_TRANSDIRBILL ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MREQBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_MREQBILL ADD (FCOMMENT NVARCHAR(510) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_OTHEROUTBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_OTHEROUTBILL ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_OTHERINBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_OTHERINBILL ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PRODUCTINBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_PRODUCTINBILL ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_PURRECBILL ADD (FCOMMENT NVARCHAR(512) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_MREQOUTBILL' AND KSQL_COL_NAME ='FCOMMENT') 
 ALTER TABLE T_IM_MREQOUTBILL ADD (FCOMMENT NVARCHAR(510) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVSCHEMES' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_IM_INVSCHEMES ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVSCHEMES' AND KSQL_COL_NAME ='FDESCRIPTION') 
 ALTER TABLE T_IM_INVSCHEMES ADD (FDESCRIPTION NVARCHAR(200) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVSCHEMEGROUP' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_IM_INVSCHEMEGROUP ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVSCHEMEGROUP' AND KSQL_COL_NAME ='FFULLNAME') 
 ALTER TABLE T_IM_INVSCHEMEGROUP ADD (FFULLNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );

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