Ever created a function and needed to include the Order By clause. It would result in the following error being loaded:
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.
The problem is that to use, it requires a TOP clause or FOR XML. By if you specify TOP 100, you’ll only get the first 100 rows. You can specify a big number that you might think will never exceed. But what if you do? The best bet is to use TOP 100 PERCENT.
This will get you all the rows and works in Functions.
No Responses