multipart identifier could not bound

  • hi

    i have query like this

    select ra.column, r1,column2

    from emp ra inner join

    emp1 r1

    on r1.empid = ra.empid

    .

    i need to add 1more field from emp1. but when i am trying getting error like 'The multi-part identifier "r1.emp2" could not be bound.'

  • Is your real query more complicated than this?

    If so, the table alias you're using could be out of scope.

    If you post the query we can take a look at it.

  • can you please post your actual query so that we can look into that

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • select distinct rl.Id,

    rl.AlarmId, rl.Name

    From T.dbo.BHI_Alarm ra with (nolock)

    Inner Join T.dbo.BHI_Library rl with (nolock)

    On rl.id = ra.id

    and rl.BatchId = ra.BatchId

    and rl.nameid = @nameid

    and rl.AId = @AId

    and (ra.memberid = @memberid or ra.CustomerId = @cid)

  • riya_dave (7/10/2013)


    select distinct rl.Id,

    rl.AlarmId, rl.Name

    From T.dbo.BHI_Alarm ra with (nolock)

    Inner Join T.dbo.BHI_Library rl with (nolock)

    On rl.id = ra.id

    and rl.BatchId = ra.BatchId

    and rl.nameid = @nameid

    and rl.AId = @AId

    and (ra.memberid = @memberid or ra.CustomerId = @cid)

    Can you share some details? What are trying to add to your query? What do the tables look like?

    And be careful with using the NOLOCK hint. Do you know what that hint brings to the table? http://sqlblogcasts.com/blogs/tonyrogerson/archive/2006/11/10/1280.aspx

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • i need to add 1more field from emp1. but when i am trying getting error like 'The multi-part identifier "r1.emp2" could not be bound.'

    The above means that there is no column named "emp2" in a table/view/subquery/anything else referenced by the alias "r1"

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • i can see that column name in my table.

    also when i type alias my intellisense for that table doesnt get anything, if i type anoter table name

    it display all the fields for that table?

  • riya_dave (7/10/2013)


    i can see that column name in my table.

    also when i type alias my intellisense for that table doesnt get anything, if i type anoter table name

    it display all the fields for that table?

    You need to post accuratly complete query you're written.

    The one posted:

    select ra.column, r1,column2

    from emp ra inner join

    emp1 r1

    on r1.empid = ra.empid

    has a comma instead of dot between "r1" and "column2" in a select line, which would cause another errorr.

    Can you also post DDL for your "emp" and "emp1" tables

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • Are you checking on the same server and database? (it has happened to me more than once)

    Are you sure the spelling of the alias is correct?

    Have you refreshed the Intellisense local cache?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply