yangyi
项目合作联系我: yangyi_love@hotmail.com

导航

 
DROP PROCEDURE IF EXISTS `CreateIndex` $$
CREATE  PROCEDURE `CreateIndex`()
BEGIN
  SET @rn=0;
  UPDATE `表名` SET id = (@rn:=@rn+1) ORDER BY '列名' ASC;
  alter table `表名`add PRIMARY KEY (id);
  ALTER TABLE `表名` MODIFY id int(10) unsigned NOT NULL auto_increment;
END $$
posted on 2010-05-06 13:52  谁是菜鸟?  阅读(164)  评论(0编辑  收藏  举报