要将数据重新插入表中时,如何刷新唯一索引? [英] how can i refresh Unique Index when i want to reinsert data into table?

查看:63
本文介绍了要将数据重新插入表中时,如何刷新唯一索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.

我已经在Sqlserver 2008r2中创建了一个表,如下所示:

Table = Country(CountryId(Int,not null,Unique Index),CountryName(NvarChar))

我已经将数据插入到该表中,但是我决定删除它们,现在当我想将数据重新插入到表中时,它已经记住了以前的索引和
CountryId从(例如14)开始,而我想从1开始.
我该怎么办?

Hi.

i have created a Table in Sqlserver 2008r2 as below:

Table=Country(CountryId (Int,not null,Unique Index) ,CountryName (NvarChar))

I had inserted data into this table , but i decided to delete them , now when i want to reinsert data into the table , it has memorized it''s previous Indexes and
CountryId starts from (for example 14), while i want to start it from number 1.
what shall i do?

推荐答案

我想您无权访问Google?我在google上输入了您的问题并得到了这个信息:

DBCC CHECKIDENT("mytablename",RESEED,新标识值)

换句话说

DBCC CHECKIDENT(国家",RESEED,1)
I guess you don''t have access to google ? I typed your question in to google and got this:

DBCC CHECKIDENT (''mytablename'', RESEED, new identity value)

In other words

DBCC CHECKIDENT (''Country'', RESEED, 1)


这篇关于要将数据重新插入表中时,如何刷新唯一索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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