Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing error message #14

Open
terrajobst opened this issue Oct 31, 2014 · 1 comment
Open

Missing error message #14

terrajobst opened this issue Oct 31, 2014 · 1 comment

Comments

@terrajobst
Copy link
Owner

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants