none
Multi-line comments in SQL code RRS feed

  • Question

  • The code formatting was one of the additions to the new forum layour that I really like, but sadly I have found a (minor) bug in it!
    If you have /*multi line comment blocks*/ in SQL, it doesn't display properly (see below)

    --single line comments work fine!     
        
    /* but not so good*/     
        
    /*     
    when you use this style of commenting     
    */    
     
    /*  
    They get worse if you decide to use apostrophes  
    What's up with that!?
    */
    SELECT 'see?' 

    So as you can see, it can really knock out the rest of your code formatting and make it a lot harder to read!

    Cheers for reading,
    George
    Wednesday, December 31, 2008 10:33 AM

Answers

All replies

  • The code block formatter is pretty broken.  It is not going to get fixed, it's another company that owns the problem, not MSFT.  If you really care about what your code snippets look like on this forum, use FireFox.  Copied and pasted from your post:

    --single line comments work fine!    
       
    /* but not so good*/    
       
    /*    
    when you use this style of commenting    
    */   
     
    /* 
    They get worse if you decide to use apostrophes 
    What's up with that!?
    */
    SELECT 'see?'

    Hans Passant.
    Thursday, January 1, 2009 12:02 AM
  • I stopped using FF with the old layout because it just wasn't worth the effort with the wysiwyg editor, if you reckon they've made it more accessible then I'll definately be switching back!


    George
    Friday, January 2, 2009 9:05 AM
  • Worthy of a test...

    -- single line comment test
     
    /* another test */
    /* 
    Is this commented out?
    */
    /* and now the apostrophe test.
    What's going to happen?
    */
    It comments out between two apostrophes? 'maybe'

    The preview was golden. Let's see how it displays.


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Thursday, May 24, 2012 11:31 PM
    Owner
  • The Code Block has been updated. I verified that it's fixed. I cannot repro this. Please post a reply if you can repro this issue.

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Experience Program Manager (Blog, Twitter, Wiki)

    Thursday, May 24, 2012 11:32 PM
    Owner