SQL-Server 2005: The multi-part identifier ... could not be bound.
My error message:
The mult开发者_开发知识库i-part identifier table2.ValidSince" could not be bound.
UPDATE table1
SET table1.ValidSince = table2.ValidSince
WHERE table1.ID = '5C954C6F-FFD7-454A-9E2B-000076523819'
How do I need to change the update to make it work?
You need to join on to table2
UPDATE t1
SET t1.ValidSince = t2.ValidSince
From Table1 t1
Join Table2 t2 on t1.PKCol = t2.PKCol
WHERE t1.ID = '5C954C6F-FFD7-454A-9E2B-000076523819'
You haven't declared table2
anywhere in your statement. You need to include table2
in order to be able to use it.
UPDATE t1
SET t1.ValidSince = t2.ValidSince
FROM Table1 t1
JOIN #Table2 t2
ON t1.PKCol = t2.PKCol
WHERE t1.ID = '5C954C6F-FFD7-454A-9E2B-000076523819'
精彩评论