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 Text string with matching ID?

Author  Topic 

FruitBatInShades
Yak Posting Veteran

51 Posts

Posted - 2006-03-09 : 05:57:54
I have 2 tables TownsCounties and Counties

TownsCounties Has TownUniqueID, Town, County

Counties has CountyUniqueID, County

I need to add a new column to Towns that has the CountyUniqueID from the counties table to the townsCOunties table. Basically match the text description to the UniqueID.

Any ideas?

FruitBatInShades
Yak Posting Veteran

51 Posts

Posted - 2006-03-09 : 06:09:32
UPDATE TownCountyList
SET CountyID = Counties.UniqueID
FROM TownCountyList INNER JOIN
Counties ON (TownCountyList.County = Counties.County)
Go to Top of Page
   

- Advertisement -