Created
March 18, 2018 01:23
-
-
Save alexdwhite/0d0a49279fadaacb7b13909eda0d4006 to your computer and use it in GitHub Desktop.
I wrote a joined updated statement today, and figured it would be good to get some generic code up here to reference in the future. Here is how to do a simple update that updates the values of one table, to another on a common key.
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
update | |
a | |
set | |
a.Field1 = b.Field1, | |
a.Field2 = b.Field2 | |
from tableA a | |
inner join tableB b on a.fKey = b.pKey | |
where a.pKey = @someValue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment