存储过程增加字段的方法
DROP PROCEDURE IF EXISTS `ALTER_Field`$$ CREATE PROCEDURE `ALTER_Field`() BEGIN #InApp_MobiPhone 表增加extraInfo IF EXISTS (SELECT * FROM information_schema.columns WHERE table_name = 'InApp_MobiPhone' AND column_name = 'extraInfo') = FALSE THEN ALTER TABLE `InApp_MobiPhone` add extraInfo varchar(500) DEFAULT NULL; END IF; #InApp_MobiPhone表增加dagedatradeId IF EXISTS (SELECT * FROM information_schema.columns WHERE table_name = 'InApp_MobiPhone' AND column_name = 'dagedatradeId') = FALSE THEN ALTER TABLE `InApp_MobiPhone` add dagedatradeId varchar(500) NOT NULL; END IF; END$$ DELIMITER ; CALL ALTER_Field(); DROP PROCEDURE IF EXISTS `ALTER_Field`;