Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 The multi-part identifier could not be bound

Author  Topic 

Ironwil
Starting Member

8 Posts

Posted - 2011-06-02 : 17:09:39
I've searched for the answer to this error message, but every single one of the articles I found dealt with joins, inner queries, and/or aliases. Neither of these apply in my case. Here is a query that is causing the issue:

SELECT [Database_One].[dbo].[s_Users].[ID]
FROM [Database_One].[dbo].[s_Users]
WHERE [Database_One].[dbo].[s_Users].[NTLogin] = [Database_Two].[dbo].[tUserRoles].[userID]
AND [Database_Two].[dbo].[tUserRoles].[userRoleID] = [Database_Two].[dbo].[tProjectUsers].[userRoleID]


And I get the error. I'm not using any joins, inner queries, or aliases. I should mention that this is actually an inner query that causes the following error when it's run:

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

I pulled out the query shown above to see what results it was returning multiple values for, only to find that it yielded the above-mentioned error. Both databases are hosted on the same server, and I refer to them with a complete name every place they are used, so I'm not sure what to make of this error.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-06-02 : 17:16:57
That syntax will not work in SQL Server, try this:

SELECT Users.[ID]
FROM [Database_One].[dbo].[s_Users] Users
INNER JOIN [Database_Two].[dbo].[tUserRoles] UserRoles ON Users.[NTLogin] = UserRoles.[userID]
INNER JOIN [Database_Two].[dbo].[tProjectUsers] ProjectUsers ON UserRoles.[userRoleID] = ProjectUsers.[userRoleID]
Go to Top of Page
   

- Advertisement -