Home >Database >Mysql Tutorial >删除表的记录以后,如何使新记录的编号仍然从1开始_MySQL

删除表的记录以后,如何使新记录的编号仍然从1开始_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-01 13:54:591116browse

有两种方法:
方法1:
truncate table 你的表名 --这样不但将数据删除,而且可以重新置位identity属性的字段。

方法2:
delete from 你的表名
dbcc checkident(你的表名,reseed,0) --重新置位identity属性的字段,让其下个值从1开始

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn