4

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

1 Answer 1

1

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.

2
  • Either this change never went live, or something is stopping the added error to occur.
    – Mark Hurd
    Aug 21, 2012 at 16:15
  • Hasn't gone live yet. We're working on getting everything reviewed and pushed out ASAP (lots of changes in the pipe), sorry for the delay.
    – Tim Stone
    Aug 21, 2012 at 16:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .