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 2000 Forums
 Transact-SQL (2000)
 replace?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ce7
Starting Member

1 Posts

Posted - 03/16/2012 :  16:38:19  Show Profile  Reply with Quote
Hi I am newb to webdesign and using SQL, PHP

in the zones table, I had
zone_id,
zone-country_id,
zone_code
zone_name

without fully understand, I put zone_code and zone_name wronly.
i mean i put the zone_code value which suppose to be zone_name, and the zone_name which suppose to be zone_code. There are more then 1000 lines there.

Can any one please help me and see if any command that can switch the value?

Many thanks in advance.

X002548
Not Just a Number

15586 Posts

Posted - 03/16/2012 :  16:50:00  Show Profile  Reply with Quote
Ummmm....no

Is Zone_Id an Identity?

SELECT * INTO newZonesTable FROM ZonesTable

UPDATE Z SET Zone_Name = n.Zone_Code, Zone_Code = n.Zone_Name
FROM ZonesTable Z JOIN newZonesTable n
ON Z.Zone_Id = n.Zone_Id

make sure it's right, then drop the newZonesTable

Zone_Id...very Funny

And useful in this case


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


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.2 seconds. Powered By: Snitz Forums 2000