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 2000 Forums
 Transact-SQL (2000)
 seqguence update

Author  Topic 

hai
Yak Posting Veteran

84 Posts

Posted - 2007-07-20 : 15:47:43
I need to update the column change move up 1. If it null than begin with R1,
if it has value then add 1 up. eg:

id Values
1 - R1
1 - R2
1 - R3
1 - Null
2 - Null
3 - R1
3 - R2
3 - Null
4 - R1
4 - Null

Update Result

id Values
1 - R4
1 - R3
1 - R2
1 - R1
2 - R1
3 - R3
3 - R2
3 - R1
4 - R2
4 - R1

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-07-20 : 16:39:40
Is there any PK in the table?

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-07-20 : 22:34:34
Sounds to me you did not have the correct concept of how records are store in table.

There isn't a FIRST or LAST record of a table. Records are not stored in any particular order in a table. You determine the order of how you want the record to retrieve using the ORDER BY clause (with ASC or DESC) in the SELECT statement.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -