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
 Transact-SQL (2005)
 Update data with sequential numbers

Author  Topic 

freshfitz
Starting Member

5 Posts

Posted - 2008-02-20 : 22:36:11
I have a sql database with a customer list each customer has a customer number "cust_no". I need to change the customer number and update each sequential with the next number. example table customer cell cust_no original cust_no is 1002 - 3002 I need to change or update it to 211925 - 2114927

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-02-21 : 00:11:44
Use simple math to update the data.

UPDATE Table1
SET Column1 = Column1 + 20000

If this isn't what you want, please provide more details.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

freshfitz
Starting Member

5 Posts

Posted - 2008-02-21 : 00:49:54
Awesome that worked I just had to create a temp table do the update to the temp table then delete the existing and rename the temp to the original
Go to Top of Page
   

- Advertisement -