SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Update data with sequential numbers
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

freshfitz
Starting Member

5 Posts

Posted - 02/20/2008 :  22:36:11  Show Profile  Reply with Quote
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

USA
37133 Posts

Posted - 02/21/2008 :  00:11:44  Show Profile  Visit tkizer's Homepage  Reply with Quote
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 - 02/21/2008 :  00:49:54  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000