Possible Duplicate:
How to update two tables in one statement in SQL Server 2005?
I have an update statement. It Updates one field but inner joins on another table to complete the where clause. I am using MS SQL.
I am now trying to update a field on the joined table but cannot seem to do it. I have read that you can only update one table at a time. Is this true? Is there a way I can get around this?
Here is my statement
update tbl_calendardatebox
set
tbl_calendardatebox.HeaderBgColour = @value,
tbl_calendarobjects.Saved = '0'
from tbl_calendardatebox db
inner join tbl_calendarobjects o on
db.ObjectId = o.Id
where o.PageId = @page
and o.GroupField = @group and o.GroupField <> '-1'
and o.Visible = '1'
and o.CanUserEdit = '1'
and db.HeaderBgColour <> @value
So the two tables are tbl_calendardatebox and tbl_calendarobjects. I get the error message on tbl_calendarobjects.Saved = '0' - The multi-part identifier "tbl_calendarobjects.Saved" could not be bound.
Any help will be appreciated.