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)
 Increment Column Value

Author  Topic 

ljp099
Yak Posting Veteran

79 Posts

Posted - 2004-03-20 : 19:25:00
I have an int column itemID.

I want to create a stored procedure which loops through all the records and increments the ItemID value by 1 (beginning with number 1). EG:

ItemID=1
ItemID=2
ItemID=3


Can someone help me with the code for this?

Thanks

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-03-21 : 05:53:48
UPDATE TableName
SET ItemID = ItemID + 1


Duane.
Go to Top of Page
   

- Advertisement -