I am totally bewildered by this one... Execution plan says No Join Predicate but if I hard code the ID for the where clause instead of using a variable, it's fine...
DECLARE @TableOneID int = 1234
SELECT
TableOne.JustAField, TableTwo.AnotherField
FROM
TableOne
INNER JOIN
TableTwo on TableTwo.TableOneID = TableOne.TableOneID
WHERE
TableOne.TableOneID = @TableOneID
If I replace the variable in the where clause with 1234, the query plan is fine... what am I missing?
MS SQL Server 2019 (not sure what compatibility mode)