/**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_PURINBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLENTITY') 
 ALTER TABLE T_IM_PURINBILLENTRY_R ADD (FCONBILLENTITY NVARCHAR(36) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURINBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLNUMBER') 
 ALTER TABLE T_IM_PURINBILLENTRY_R ADD (FCONBILLNUMBER NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURINBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLROWNUM') 
 ALTER TABLE T_IM_PURINBILLENTRY_R ADD (FCONBILLROWNUM NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURINBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLID') 
 ALTER TABLE T_IM_PURINBILLENTRY_R ADD (FCONBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURINBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLENTRYID') 
 ALTER TABLE T_IM_PURINBILLENTRY_R ADD (FCONBILLENTRYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_SALOUTBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLENTITY') 
 ALTER TABLE T_IM_SALOUTBILLENTRY_R ADD (FCONBILLENTITY NVARCHAR(36) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_SALOUTBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLNUMBER') 
 ALTER TABLE T_IM_SALOUTBILLENTRY_R ADD (FCONBILLNUMBER NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_SALOUTBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLROWNUM') 
 ALTER TABLE T_IM_SALOUTBILLENTRY_R ADD (FCONBILLROWNUM NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_SALOUTBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLID') 
 ALTER TABLE T_IM_SALOUTBILLENTRY_R ADD (FCONBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_SALOUTBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLENTRYID') 
 ALTER TABLE T_IM_SALOUTBILLENTRY_R ADD (FCONBILLENTRYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLENTITY') 
 ALTER TABLE T_IM_PURRECBILLENTRY_R ADD (FCONBILLENTITY NVARCHAR(36) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLNUMBER') 
 ALTER TABLE T_IM_PURRECBILLENTRY_R ADD (FCONBILLNUMBER NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLROWNUM') 
 ALTER TABLE T_IM_PURRECBILLENTRY_R ADD (FCONBILLROWNUM NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLID') 
 ALTER TABLE T_IM_PURRECBILLENTRY_R ADD (FCONBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_PURRECBILLENTRY_R' AND KSQL_COL_NAME ='FCONBILLENTRYID') 
 ALTER TABLE T_IM_PURRECBILLENTRY_R ADD (FCONBILLENTRYID BIGINT DEFAULT 0 NOT NULL );

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