Below are two examples of what I'm trying to run:
UPDATE db1..table1
SET tb1.newValue = lt1.udfvalue
FROM db2..lookup_table lt1,
db1..table1 tb1
WHERE lt1.ID = tb1.ID
AND lt1.userdefinedfieldtypename = 'Test'
UPDATE db1..table1
SET tb1.NUM=tb2.NUM
FROM db1..table1 tb1,
db1..table1 tb2
WHERE tb2.STATUS='Final'
and tb1.ID=tb2.ID
and tb1.STATUS='Revised'
and tb1.NUM is NULL
It has something to do with the aliases, but I'm out of ideas right now. How can I fix this? Thanks
Use the alias in the UPDATE
statement:
UPDATE tb1
SET tb1.NUM=tb2.NUM
FROM db1..table1 tb1,
....