简体   繁体   中英

How to update the index value in SQL Server 2008

PFB my table structure

App id name
----- ------
1      Agile 
4      sdlc

While entering data in above tables I wrongly entered some data twice. The index values has been changed to 4 instead of 2.

But I need the below index order

App id name
----- ------
1      Agile 
2      sdlc

If you are using [App ID] in a UI and are concerned that users will highlight gaps in the values between records, then you shouldn't be using an identity column in this way. It's probably best you rethink your design and what you are trying to achieve. You could use an int column, or even a varchar, that you control yourself while using a primary key constraint.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM