Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2008
    Posts
    2

    Unanswered: msg 4104, The multi-part id... could not be bound

    UPDATE [rki-erp_dev2].dbo.cust_location
    set fax_number = (select ltrim(rtrim(fax))--, fax_number, bc.[customer code], cl.code
    from [RKI-ERP_current_data].dbo.bamCONTACTS bc
    inner join [rki-erp_dev2].dbo.cust_location cl
    on bc.[customer code] = cl.code
    where fax is not NULL
    and ltrim(rtrim(fax)) <> 'NONE'
    and ltrim(rtrim(fax)) <> '')
    --and bc.[customer code] = cl.code)
    where [RKI-ERP_current_data].dbo.bamCONTACTS.[customer code] = [rki-erp_dev2].dbo.cust_location.code

    Msg 4104, Level 16, State 1, Line 1
    The multi-part identifier "RKI-ERP_current_data.dbo.bamCONTACTS.customer code" could not be bound.


    I'm at a loss.

    Thanks

    Cliff

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    If you re-write the query in a constructive format, it becomes a lot clearer...

    How does this work for you?
    Code:
    UPDATE [rki-erp_dev2].dbo.cust_location
    SET    fax_number = bc.fax
    FROM   [RKI-ERP_current_data].dbo.bamCONTACTS bc
     INNER
      JOIN [rki-erp_dev2].dbo.cust_location cl
        ON bc.[customer code] = cl.code
    WHERE  NullIf(bc.fax, '') IS NOT NULL
    AND    LTrim(RTrim(fax)) <> 'NONE'
    George
    Home | Blog

  3. #3
    Join Date
    Nov 2008
    Posts
    2
    That worked.
    Now to study and understand why.

    Thanks.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    You've aliased your tables but not used the alias in your query. Personally, I don't like leaving out AS since otherwise it is easy to miss.
    Code:
    FROM   [RKI-ERP_current_data].dbo.bamCONTACTS AS bc
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Oh yeah - and there were two WHERE clauses!
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •