I want to start building a tool that more or less shows you the data-lineage of a query using parsing of the execution plan - so that you get information of the form:
Column A of Table XY was computed by taking Column B of Table XZ and adding Column C of Table PL
You get the idea :)
Now, when I tried some queries and looking at the corresponding execution plans, I ran into the issue that there was a random expression present without any definition as to how it is computed.
It appeared in a nested Loop OuterReferences Section, I queried just one table and seemingly performed an index scan followed by a key lookup. When "joining" those 2, the index scan and the key lookup, the query plan XML just showed:
ColumnReference = Column="Expr1020"
I tried searching the XML-File for another occurrence of Expr1020, but there were none.
Now, my question is: can anybody explain why this happens or what exactly happens in the query plan?
I figured every expression used should have a definition that is in some way based on the columns used, but this one is never referenced again :/