Skip to the content.

When performing a Single-style query and top is specified, you should use top 2; additional rows beyond that never be reached, so they’re just wasting bandwidth. If we only select top 1, then we’ll never perform the “multiple row” validation that defines Single, so: we’re actually only performing a First.

Change the value of top, or switch to First instead of Single.

Bad:

select top 1 Id, Name
from Users
where UserName = @cn

Good:

select top 2 Id, Name
from Users
where UserName = @cn