如何使mysql中的auto_increment连续 [英] how to make the auto_increment in mysql consecutive

查看:132
本文介绍了如何使mysql中的auto_increment连续的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



我试图通过使用像这样的自动增量来改变表来添加索引列;

Hello

I have tried to alter a table to add a index column by using auto increment like this;

alter table donordetails add SlNo int not null auto_increment first ,add unique key(SlNo);





它正在工作,但值的递增不是连续的,有时是随机的价值即将到来,那该怎么办?



任何类似于mssql中的身份(1,1)的方法



问候

Ginnas



It is working, but the incrementing of the value is not consecutive, some times random value is coming, so what to do ?

any methode something like identity(1,1) in mssql

Regards
Ginnas

推荐答案

尝试



Try

PRIMARY KEY (`SlNo`)


这篇关于如何使mysql中的auto_increment连续的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆