Is there a keyword or metainformation in SQL Server that'll tell you if TOP took effect?
EX:
Select TOP 5 * From Stuff
RESULT: 5 rows
What is the best way to determine if there would have been 6 or more?
I could do:
SELECT TOP 6 count(*) FROM Stuff
But I am concerned about a separate call to retrieve the count because there actual query is much more complicated than this one and on a large table.
Thanks!
TOP
withoutORDER BY
is pretty pointless - you'll get theTOP
rows ordered by what?!?! – OosporeTOP xxx
and he'd like to know if there's a way to tell if thatTOP
clause actually limited the result set or not. (i.e. if his query just happened to return 5 rows, or there were more rows but theTOP
limited it) – BobbyORDER BY
wouldn't affect what he's asking. – Bobby