SQL Server Performance Forum – Threads Archive
SELECT confusion
the code below returns the minimum missing value This code works fine returning the minimum missing int value But I strongly felt that the first lineselect min(A.keycol+1) should be a constant, does not change at all.
select min(A.keycol+1) as MissingMinimumValue
from dbo.T1 as A
where not exists
( select * from dbo.T1 as B
where B.keycol = A.keycol+1
) ——————
Bug explorer/finder/seeker/locator
——————
Another example is SELECT min(A.keycol+1) AS MissingMinimumValue
FROM dbo.T1 AS A
LEFT JOIN dbo.T2 AS B
ON B.keycol = A.keycol+1
WHERE B.keycol IS NULL ——————
Bug explorer/finder/seeker/locator
——————
Are you asking question or providing solution? [<img src=’/community/emoticons/emotion-5.gif’ alt=’

The confusion here is I think MIN() function against a specific set should be an unchanging constant? I think I already have the answer. ——————
Bug explorer/finder/seeker/locator
——————
]]>