July 10, 2013 at 7:32 am
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.'
July 10, 2013 at 7:53 am
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.
July 10, 2013 at 7:59 am
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/
July 10, 2013 at 8:13 am
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)
July 10, 2013 at 8:17 am
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/
July 10, 2013 at 9:44 am
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"
July 10, 2013 at 9:51 am
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?
July 10, 2013 at 9:59 am
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
July 10, 2013 at 10:01 am
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?
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply