Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 Renumbering with stored procedure or trigger

Author  Topic 

programer
Posting Yak Master

221 Posts

Posted - 2010-12-20 : 18:24:54
Hi,

I'd like to know how interspersed insert record?


An example I have data

Id, Number, FirstName
87, 1, FirstName1
88, 2, FirstName2
89, 3, FirstName3
90, 4, FirstName4
91, 5, FirstName5



How to record Id = 90, move up.
Example:

Record
90, 4, FirstName4, I want to move to:


Id, Number, FirstName
87, 1, FirstName1
88, 2, FirstName2
91, 5, FirstName5 - moved here
89, 3, FirstName3
90, 4, FirstName4


How do I re-numbered figures in the column Number?

Should look like this:

Id, Number, FirstName
87, 1, FirstName1
88, 2, FirstName2
91, 3, FirstName5 - moved here
89, 4, FirstName3
90, 5, FirstName4

Regards
   

- Advertisement -