Msg 104381 when running INSERT...SELECT statement in Analytics Platform System 2016 or later


When you run an INSERT ... SELECT statement in Microsoft Analytics Platform System (APS) 2016 or a later version of APS and that statement includes an ORDER BY clause, you receive an error message that resembles the following:

Msg 104381, Level 16, State 1, Line 26

The ORDER BY clause is invalid in views, CREATE TABLE AS SELECT, INSERT SELECT,

inline functions, derived tables, subqueries, and common table expressions,

unless TOP or FOR XML is also specified.



This issue occurs because sort operations aren't valid with the INSERT ... SELECT statement. This is by design.


To fix this problem, remove the ORDER BY clause from the statement.

More Information

In earlier versions of APS, no error may have been returned. However, the ORDER BY clause was not honored.

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.