Menu

Please always show comments in SQL

2007-03-12
2012-11-13
  • Nobody/Anonymous

    Not always are comments in SQL shown as such.
    When I type this:
    ...
    INNER JOIN    #JoinTable JT        -- Here I am commenting, but this won't be shown
    ON        ST.column = JT.column    -- This line will be shown as comment, OK
    ...

    The second line of comment ("-- This line will be shown as comment, OK") is colored green nicely and also in italic.

    The first line of comment ("-- Here I am commenting, but this won't be shown") won't be marked and shown as such.

    I noticed that removing the # will make the comment mark up return, but of course I would like this to always be shown, also when I use a # to mark a temporary table.

    Could you improve this?

     
    • Nobody/Anonymous

      (How) can I fix this for the SQL language I use?
      Can I create a User Defined Language deducted from the currently implemented SQL language and throw away the # recognition and treatment?

       
    • Nobody/Anonymous

      As mentioned before, the SQL markup language/syntax highlighting is not correct.
      When there is a # in the line, anything behind it gets no mark-up at all, while in fact it should.

      # is used as a prefix for temporary tables. It has no meaning as a comment statement or anything like that.

      Could you please fix this?

       
      • Robert Romberger

        This is not completely correct. In MySQL, the # DOES indicate a comment. In Just about all other SQL implementations, the # is normally an escape character. In MSQL (Microsoft's), the # is used to specify an alias name such as:
        …WHERE[ WITH(<columns>) AS #<alias_name>]
        [,WITH(<columns>) AS #<alias_name>]

        Pick your poison here. The correct comment characters are:
        -- for single line comments
        and
        /* for multi-line comments
        such as this*/

        Bob

         
    • Nobody/Anonymous

      I know about the comment characters. I am indeed using MSQL.
      I didn't realize there were multiple SQL layouts. I couldn't get that from the single available SQL language mark up.