Created
October 13, 2011 12:34
-
-
Save bergquist/1284128 to your computer and use it in GitHub Desktop.
Merge into
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
merge into Customer.Address as Target | |
using Customer.AddressUpdates as Source | |
on Target.CustomerNumber=Source.CustomerNumber | |
when matched then | |
update set Target.FirstName = Source.FirstName, | |
Target.LastName = Source.LastName, | |
Target.StreetAddress = Source.StreetAddress, | |
Target.Email = Source.Email, | |
Target.IsVip = Source.IsVip, | |
Target.GroupRabat = Source.GroupRabat, | |
Target.City = Source.City, | |
Target.ZipCode = Source.ZipCode, | |
Target.Salution = Source.Salution, | |
Target.Phonenumber = Source.Phonenumber, | |
Target.BirthDate = Source.BirthDate | |
when not matched then | |
insert (CustomerNumber, FirstName, LastName, StreetAddress, Email, IsVip, GroupRabat, City, ZipCode, Salution, Phonenumber, BirthDate) | |
values (Source.CustomerNumber, Source.FirstName, Source.LastName, Source.StreetAddress, Source.Email, Source.IsVip, Source.GroupRabat, Source.City, Source.ZipCode, Source.Salution, Source.Phonenumber, Source.BirthDate); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment