|
-
Oct 22nd, 2012, 12:36 PM
#1
Thread Starter
Fanatic Member
[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
-
Oct 22nd, 2012, 01:20 PM
#2
Re: The multi-part identifier could not be bound error
you missed the from clause...
-tg
-
Oct 22nd, 2012, 01:39 PM
#3
Thread Starter
Fanatic Member
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
-
Oct 22nd, 2012, 03:10 PM
#4
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
-
Oct 22nd, 2012, 05:10 PM
#5
Thread Starter
Fanatic Member
Re: The multi-part identifier could not be bound error
Thanks for explaining. It's all working now.
Proctor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|