News

Copyright © 2008-2018 Paula DiTallo

Tag Cloud



SQL Server: Why do I get "multi-part identifier could not be bound" ?

 

Let's say you've developed a stored procedure that assigns a count value to a variable which looks like this:

SELECT @HasDefaultShipTo = count(*)
  FROM StakeHolderLoc_Assoc 
    WHERE assoc.StakeHldrID = @StkhldrID

When you execute to compile you will see the error:

Msg 4104, Level 16, State 1, Procedure MetroDevETL_1, Line 80
The multi-part identifier "assoc.StakeHldrID" could not be bound.

The reason this error appears is because you have forgotten to associate/bind the table to "assoc". The corrected SQL will look like this:

SELECT @HasDefaultShipTo = count(*)
  FROM StakeHolderLoc_Assoc assoc
    WHERE assoc.StakeHldrID = @StkhldrID

 

Thursday, August 6, 2009 4:13 PM

Feedback

# re: SQL Server: Why do I get "multi-part identifier could not be bound" ?

This helped, thanks.

I was trying to declare two different variables, and ended up repeating the FROM and WHERE statement, even though it was coming from the same table. 1/12/2011 8:39 AM | Aligolightly

Post A Comment
Title:
Name:
Email:
Comment:
Verification: