SQL Server Error 4104: The multi-part identifier could not be bound.

If you get an error telling you that the “The multi-part identifier could not be bound.”, it usually means that you’re prefixing one or more columns with either a table that isn’t included in your query, or an alias that you haven’t actually assigned to a table.

Fortunately, the error message shows you which multi-part identifier is causing the problem.

Example

Here’s an example to demonstrate how to get the error.

SELECT * FROM Cats
INNER JOIN Dogs d
ON c.CatName = d.DogName;

Result:

Msg 4104, Level 16, State 1, Line 3
The multi-part identifier "c.CatName" could not be bound.

In this example, I forget to include an alias for the Cats table.

The error will also occur if you try to reference the table name after you’ve already provided an alias.

Like this:

SELECT * FROM Cats c
INNER JOIN Dogs d
ON Cats.CatName = d.DogName;

Result:

Msg 4104, Level 16, State 1, Line 3
The multi-part identifier "Cats.CatName" could not be bound.

So in this case, I correctly assigned the alias, but in the ON clause I referenced the actual table name instead of the alias.

The Solution

So the solution is to ensure you’ve assigned all aliases that you might reference later in the query, and also to make sure you use those aliases instead of the table name directly.

So if you’re going to use aliases, like this:

SELECT * FROM Cats c
INNER JOIN Dogs d
ON c.CatName = d.DogName;

Or if you choose not to use aliases, like this:

SELECT * FROM Cats
INNER JOIN Dogs
ON Cats.CatName = Dogs.DogName;