重新安排SQL 2005中的自动增量 [英] Re Arrange auto increment in sql 2005

查看:76
本文介绍了重新安排SQL 2005中的自动增量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好....首先我添加了10个数据,然后我删除了第10个数据,然后又添加了一个订单.订单号未设置id1,2,3,4,5,6,7,8,9,_?_ 11如何重新排列此

hello .... first i added 10 data ,then i deleted order no 10th data,and again i added one order. the order no set id1,2,3,4,5,6,7,8,9,_?_11 how to rearrange this

推荐答案

如果您的列是自动递增即为"Identity",则无法重新排列.
因为它是主要的inseration,所以值不能重复.
If your column is Auto incremented that is "Identity" then you can not rearrange it.
cause it''s a primary inseration and value can not be repeat.




您可以通过从表中删除该列并重新创建来重新排列.

例如
Hi ,

You can rearrange by drop the column from table and re creating it.

Eg.
ALTER TABLE tablename
DROP COLUMN columnname
alter table tablename add columnname int identity(1,1)





问候,
朋友





regards,
Pal


这篇关于重新安排SQL 2005中的自动增量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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