So I'm constantly surprised by MySQL. I ran across a stored procedure today that had this in it:

SELECT SQL_CALC_FOUND_ROWS t.themeID....

A quick google search turned up this doc that describes this feature. Basically, you can use this to tell MySQL to figure out how many rows would have been returned in a query if you had left off the limit operator. It obviously slows down the query, but is not as slow as rerunning the query without the limit. (And here is a scary question - have you ever seen code that did total counts like that?) To use this feature you have to follow up with an immediate select found_rows(). Check the documentation for more information.

Anyone know if SQL Server has something like this?