[RESOLVED] The multi-part identifier could not be bound error
Hello: I'm trying to update a field in a table, based on a value that lies in a table from another database;
However, when trying to run, I get this error:
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "CompanyFromBackup.sloanled.tblJob.jobid" could not be bound.
Code:
update Company.sloanled.tblJob
set Company.sloanled.tblJob.JobOpenedDate=CompanyFromBackup.sloanled.tblJob.JobOpenedDate
where CompanyFromBackup.sloanled.tblJob.jobid=Company.sloanled.tblJob.jobid
and Company.sloanled.tblJob.jobid=1
if I just run the statement like this, it gives me one record and it runs fine:
Code:
select *
from CompanyFromBackup.sloanled.tblJob, Company.sloanled.tblJob
where CompanyFromBackup.sloanled.tblJob.jobid=Company.sloanled.tblJob.jobid
and Company.sloanled.tblJob.jobid=1
I'm working in sql server 2008 R2.
thanks,
Proctor
Re: The multi-part identifier could not be bound error
you missed the from clause...
-tg
Re: The multi-part identifier could not be bound error
techgnome: thanks for your reply.
i just ran a simple update query that works and it doesn't have the from clause:
-
Code:
-
update co.sloanled.tblJob
set co.sloanled.tblJob.JobOpenedDate='2012-08-03 16:08:00.000'
where co.sloanled.tblJob.jobid=33
so could you please elaborate?
thanks again for your help,
Proctor
Re: The multi-part identifier could not be bound error
that's because you're only dealing with one table... the from clause is implied... but when you're joining two or more tables... you need to indicate what tables you're selecting from... it's no different from your first select statement... you just have an Update/Set clause instead of a select.
-tg
Re: The multi-part identifier could not be bound error
Thanks for explaining. It's all working now.
Proctor