March 22nd, 2012, 03:43 PM
multi-part identifier could not be bound
Hi, I'm having an issue with my SQL Statement. I'm trying to declare a variable and set it to the count of the number of records that exist for a particular order number. The problem is when I execute the statement I get this error:
Msg 4104, Level 16, State 1, Line 3
The multi-part identifier "prod.dbo.HEADERS.ORDER_NUMBER" could not be bound.
I'm 100% Sure everything is spelled correctly and capitalized properly. This is the code I'm trying to run:
Any idea what might be causing this? Thank you.
DECLARE @test INT
SET @test = (SELECT COUNT(*) FROM [prod].[dbo].[LINES] WHERE [ORDER_NUMBER] = [prod].[dbo].[HEADERS].[ORDER_NUMBER])
- It's a long way to the top if you want to rock n' roll - AC/DC
Check out my band and support the music:
March 25th, 2012, 11:06 AM
Re: multi-part identifier could not be bound
your statement is on table Lines and not on Headers.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.