如何将主键和标识规范值恢复为1? [英] How to make the Primary key and identity specification value back to 1?

查看:69
本文介绍了如何将主键和标识规范值恢复为1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的表productId值是314,我想要回到1?

怎么做?

my in my Table productId value is 314 and i want that back to 1?
how to do that?

推荐答案

这是真的,真的不推荐,但是......如果你先把桌子弄空了(否则当它赶上时你会遇到问题):

It's really, really not recommended, but... if you empty the table first (otherwise you will get problems when it "catches up"):
DBCC CHECKIDENT('MyTable', RESEED, 1)



MSDN:http://technet.microsoft.com/en-us/library/ms176057.aspx [ ^ ]



哎呀!将其设置为零,而不是一个 - OriginalGriff [/ edit]


MSDN: http://technet.microsoft.com/en-us/library/ms176057.aspx[^]

[edit]Oops! Set it to zero, not one - OriginalGriff[/edit]


您好,

使用截断命令删除并重新初始化身份规范。

Hello ,
Use Truncate command to delete and reinitialize identity specification .
truncate table Customers



谢谢

animesh


thanks
animesh


这篇关于如何将主键和标识规范值恢复为1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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