update table from table in another database

begin transaction
update v
set v.domainacct = a.login
from [otherdbname].dbo.ADUserList a
inner join dbo.Vacation2011 v
on (v.lastname = a.lastname COLLATE SQL_Latin1_General_CP1_CI_AS
and v.firstname = a.firstname COLLATE SQL_Latin1_General_CP1_CI_AS)
commit transaction

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.