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
 SQL Server Development (2000)
 Update on Join

Author  Topic 

skillile
Posting Yak Master

208 Posts

Posted - 2002-06-03 : 17:26:54
/*

table Orders

ord# custUID custLink custOffid
1 534 ot-11
2 534 ot-11
3 498 ot-45
4 498 ot-45



table Customer User

UID custLink custOffid DB
1 534 ot-11 1
2 498 ot-45 1
1 111 ot-11 2 * this is OK cause John is in two differenct DB's




I am trying to assign customers to orders on a data pull.
The order record has a customer link. I want to update
table orders with the correct custUID from table [Customer User:UID]

How can I best update [table orders:custUID] with the correct [table Customer User:UID]

Thanks in advance


*/

slow down to move faster...

efelito
Constraint Violating Yak Guru

478 Posts

Posted - 2002-06-03 : 17:45:07
UPDATE [table orders]
SET custUID = tcu.UID
FROM [table Customer User] tcu
WHERE [table orders].custUID = tcu.custLink

Jeff Banschbach
Consultant, MCDBA
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-06-03 : 19:29:08
Also

http://www.sqlteam.com/item.asp?ItemID=3876



Damian
Go to Top of Page
   

- Advertisement -