Cross Apply Ambiguity - by Dave Ballantyne

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


4
0
Sign in
to vote
ID 544900 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 3/26/2010 4:48:28 AM
Access Restriction Public

Description

Cross (and outer) apply allow for ambiguous column references
Sign in to post a comment.
Posted by Tobias [MSFT] on 5/27/2010 at 11:30 AM
Hi Dave,

Thank you for your feedback. This behavior is actually by design. We resolve names one scope (query/sub query) at a time, if a match within the scope exists (in this case CteTest2.Col1) we will bind to that, we will only continue looking in the outer scope if we don't find a match in the current scope. For a JOIN between two tables with the name column name you would have to prefix the column with the table name/alias given that both names reside in the same scope.

I hope this clarifies the behavior
Thanks!
- Tobias, SQL Server Engine
Posted by Jack Corbett on 3/26/2010 at 8:37 AM
Sorry. Id10t error on my end.
Posted by Jack Corbett on 3/26/2010 at 7:09 AM
Dave,

Can you expand a little bit and maybe provide an example?