SELECT confusion | SQL Server Performance Forums

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 line
select 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
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=’;)‘ />]<br /><br /><pre id="code"><font face="courier" size="2" id="code"><br />Thanks,<br /><br />Name<br />——— <br />Dilli Grg <br /><br />(1 row(s) affected)<br /></font id="code"></pre id="code">
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