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
 General SQL Server Forums
 New to SQL Server Programming
 compare columns then update

Author  Topic 

Jsolomon
Starting Member

13 Posts

Posted - 2010-11-29 : 10:00:19
I have a tableA in DB1 with 58 columns and a tableA in a DB2 with 26 columns. I need to update a value in TableA DB1 based on compare of 5 columns from two tables.

UPDATE F SET Validrecord=5
FROM Florida_test F
INNER JOIN lola_dnm.dbo.ddnc DP
ON (F.First and F.Last and F.address and F.city and F.State)
= (DP.First and DP.Last and DP.street and DP.City and DP.ST)

This does not work! and help?

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2010-11-29 : 10:05:28
UPDATE F SET Validrecord=5
FROM Florida_test F
INNER JOIN lola_dnm.dbo.ddnc DP
ON F.First = DP.First
and F.Last = DP.Last
and F.address = DP.street
and F.city = DP.City
and F.State = DP.ST



==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

Jsolomon
Starting Member

13 Posts

Posted - 2010-11-29 : 10:12:00
Thanks works perfect!!

Jeff
Go to Top of Page
   

- Advertisement -