---紧急补丁修复共库的问题，修复系统库中T_MDR_ITEMCLASS，T_MDR_ITEMBRAND缺字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEMCLASS' AND KSQL_COL_NAME ='FSTANDARDID') 
 ALTER TABLE T_MDR_ITEMCLASS ADD (FSTANDARDID BIGINT DEFAULT 1 NOT NULL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEMCLASS' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_MDR_ITEMCLASS ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEMCLASS' AND KSQL_COL_NAME ='FFULLNAME') 
 ALTER TABLE T_MDR_ITEMCLASS ADD (FFULLNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
 
 
---T_MDR_ITEMBRAND
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEMBRAND' AND KSQL_COL_NAME ='FCREATEORGID') 
 ALTER TABLE T_MDR_ITEMBRAND ADD (FCREATEORGID BIGINT DEFAULT 0 NOT NULL );
IF  EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEMBRAND' AND KSQL_COL_NAME ='FCREATEORGID') 
 UPDATE T_MDR_ITEMBRAND SET FCREATEORGID = 100000 where FCREATEORGID = 0;
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEMBRAND' AND KSQL_COL_NAME ='FCTRLSTRATEGY') 
 ALTER TABLE T_MDR_ITEMBRAND ADD (FCTRLSTRATEGY VARCHAR(10) DEFAULT ' ' NOT NULL );
IF EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEMBRAND' AND KSQL_COL_NAME ='FCTRLSTRATEGY') 
 UPDATE T_MDR_ITEMBRAND SET FCTRLSTRATEGY = '5' where FCTRLSTRATEGY = ' ';
  
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEMBRAND' AND KSQL_COL_NAME ='FORGID') 
 ALTER TABLE T_MDR_ITEMBRAND ADD (FORGID BIGINT DEFAULT 0 NOT NULL );
IF EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEMBRAND' AND KSQL_COL_NAME ='FORGID') 
 UPDATE T_MDR_ITEMBRAND SET FORGID = 100000 where FORGID = 0;
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEMBRAND' AND KSQL_COL_NAME ='FNAME') 
 ALTER TABLE T_MDR_ITEMBRAND ADD (FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDR_ITEMBRAND' AND KSQL_COL_NAME ='FREMARK') 
 ALTER TABLE T_MDR_ITEMBRAND ADD (FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL );
 
