/**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_SALOUTBILLENTRY_R' AND KSQL_COL_NAME ='FGROUPNUMBER') 
 ALTER TABLE T_IM_SALOUTBILLENTRY_R ADD (FGROUPNUMBER 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 ='FGROUPSEQ') 
 ALTER TABLE T_IM_SALOUTBILLENTRY_R ADD (FGROUPSEQ 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 ='FGROUPNUMBER') 
 ALTER TABLE T_IM_PURINBILLENTRY_R ADD (FGROUPNUMBER 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 ='FGROUPSEQ') 
 ALTER TABLE T_IM_PURINBILLENTRY_R ADD (FGROUPSEQ NVARCHAR(50) DEFAULT ' ' NOT NULL );
 
 
 
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILLENTRY_R' AND KSQL_COL_NAME ='FGROUPNUMBER') 
 ALTER TABLE T_IM_TRANSDIRBILLENTRY_R ADD (FGROUPNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSDIRBILLENTRY_R' AND KSQL_COL_NAME ='FGROUPSEQ') 
 ALTER TABLE T_IM_TRANSDIRBILLENTRY_R ADD (FGROUPSEQ NVARCHAR(50) DEFAULT ' ' NOT NULL );
 
 
 
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSINBILLENTRY_R' AND KSQL_COL_NAME ='FGROUPNUMBER') 
 ALTER TABLE T_IM_TRANSINBILLENTRY_R ADD (FGROUPNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSINBILLENTRY_R' AND KSQL_COL_NAME ='FGROUPSEQ') 
 ALTER TABLE T_IM_TRANSINBILLENTRY_R ADD (FGROUPSEQ NVARCHAR(50) DEFAULT ' ' NOT NULL );
 
 
 
  IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSOUTBILLENTRY_R' AND KSQL_COL_NAME ='FGROUPNUMBER') 
 ALTER TABLE T_IM_TRANSOUTBILLENTRY_R ADD (FGROUPNUMBER NVARCHAR(50) DEFAULT ' ' NOT NULL );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_TRANSOUTBILLENTRY_R' AND KSQL_COL_NAME ='FGROUPSEQ') 
 ALTER TABLE T_IM_TRANSOUTBILLENTRY_R ADD (FGROUPSEQ NVARCHAR(50) DEFAULT ' ' NOT NULL );

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