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)
 replace?

Author  Topic 

ce7
Starting Member

1 Post

Posted - 2012-03-16 : 16:38:19
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 - 2012-03-16 : 16:50:00
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
   

- Advertisement -