I have embedded a start comment in a comment in this query and its Order By
clause is ignored:
Select 1 As [F]
Union all
Select 2 As [F]
/*/**/
Order By [F] DESC
...yields:
F
--
1
2
I have embedded a start comment in a comment in this query and its Order By
clause is ignored:
Select 1 As [F]
Union all
Select 2 As [F]
/*/**/
Order By [F] DESC
...yields:
F
--
1
2
The real issue is that you don't get a syntax exception for not closing the second comment. Running the SQL as-is produces the following error in SSMS:
Msg 113, Level 15, State 1, Line 5
Missing end comment mark '*/'.
Data Explorer is currently removing comments from your query prior to execution, and doesn't handle cases like this appropriately. I'll see what can be done about cases like this; it might just be better if Data Explorer doesn't try to do what it's doing now so errors like this would be thrown by SQL Server.
For right now though, I took care of this specific case.