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
 SQL Server Development (2000)
 Update a field based on value of that field in last record.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-20 : 08:36:02
Shirley writes "I have a table with the following fields: TASKID, TABLE1ID, TASKNUMBER (with TABLE1ID being a foreign key field). I want to update "TASKNUMBER" with the next incrementing number for that particular foreign key. How could this easily be accomplished? Thanks in advance."

izaltsman
A custom title

1139 Posts

Posted - 2002-06-20 : 08:47:20
You mean you just want TASKNUMBER to be a sequentially incrementing numeric field? You could either make it identity, so the numbers will be generated automatically, or you could populate it using the technique described here:

http://sqlteam.com/item.asp?ItemID=765

Go to Top of Page
   

- Advertisement -