Results 1 to 5 of 5

Thread: [RESOLVED] The multi-part identifier could not be bound error

  1. #1
    Hyperactive Member
    Join Date
    Mar 08
    Posts
    393

    Resolved [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

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 02
    Posts
    21,636

    Re: The multi-part identifier could not be bound error

    you missed the from clause...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    *Proof positive that searching the forums does work: View Thread *
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *
    * Use Offensive Programming, not Defensive Programming. * On Error Resume Next is error ignoring, not error handling(tm).
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN

  3. #3
    Hyperactive Member
    Join Date
    Mar 08
    Posts
    393

    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

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 02
    Posts
    21,636

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    *Proof positive that searching the forums does work: View Thread *
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *
    * Use Offensive Programming, not Defensive Programming. * On Error Resume Next is error ignoring, not error handling(tm).
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN

  5. #5
    Hyperactive Member
    Join Date
    Mar 08
    Posts
    393

    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
  •