terrajobst / nquery

NQuery is a relational query engine written in C#. It allows you to execute a SELECT query against .NET objects.
MIT License
72 stars 20 forks source link

Missing error message #14

Open terrajobst opened 9 years ago

terrajobst commented 9 years ago

Ported from CodePlex

This query should cause the error message below. If uncommenting the UNION ALL the error messages appears.

The ORDER BY clause is invalid in derived tables, subqueries, and common table expressions, unless TOP is also specified.

WITH MyEmployees AS (
 SELECT e.FirstName + ' ' + e.LastName AS FullName,
   e.Region,
   e.Country
 FROM Employees e
 WHERE e.Country = 'USA'
 UNION ALL

 SELECT 'Immo Landwerth',
   'Bavaria',
   'Germany'
 ORDER BY 1
)
SELECT e.FullName,
  e.Country
FROM MyEmployees e
dallmair commented 7 years ago

Hmm, is this really required? I mean the ORDER BY works and doesn't hurt (besides perf, eventually), and if the error message would be implemented one could always work around the limitation by specifying the TOP 100 PERCENT clause, so from my point of view this whole additional error message wouldn't add much value to NQuery.