Unanswered Testing code blocks

  • Sunday, March 18, 2012 1:05 PM
     
     

    This post is from the NNTP bridge without any use of markup. Post is in
    plain-text format.

    SELECT t1.col1, t2.col2
    FROM   table1 t1
    WHERE  NOT EXISTS (SELECT *
                       FROM    table3 t3
                       WHERE   t3.table2ID = t1.table2ID
                         AND   t3.col3     = t1.col3)

    When I view it, SELECT, FROM and WHERE are all nicely aligned in the
    subquery. AND is intended two columns with regards to WHERE. Likewise are
    "table3" and the two "t3." aligned.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

All Replies

  • Sunday, March 18, 2012 1:06 PM
     
     

    Again, this post is from the NNTP bridge, but this time I use [sql] to mark the code block.

    SELECT t1.col1, t2.col2
    FROM     table1 t1
    WHERE    NOT EXISTS (SELECT *
                                         FROM        table3 t3
                                         WHERE     t3.table2ID = t1.table2ID
                                             AND     t3.col3         = t1.col3)

    When I view it in my newsreader, SELECT, FROM and WHERE are all nicely aligned in the subquery. AND is intended two columns with regards to WHERE. Likewise are "table3" and the two "t3." aligned.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
  • Sunday, March 18, 2012 1:08 PM
     
     

    This time, I'm posting from the web UI. I'm not using the code-block feature.

    SELECT  t1.col1, t2.col2
    FROM     table1 t1
    WHERE  NOT EXISTS (SELECT *
                                     FROM     table3 t3
                                     WHERE  t3.table2ID = t1.table2ID
                                         AND   t3.col3     = t1.col3)

    I've manually adjusted the alignment, so it will probably look ugly when viewed from my newsreader.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

  • Sunday, March 18, 2012 1:12 PM
     
      Has Code

    This time I'm using the code block, but I am not using the preview. I'm aligning the text so that it looks pretty when I post it.

    SELECT t1.col1, t2.col2
    FROM   table1 t1
    WHERE  NOT EXISTS (SELECT * 
                       FROM   table3 t3
                       WHERE  t3.table2ID = t1.table2ID
                         AND  t3.col3     = t1.col3)
    
    

    But the text is not aligned when it comes back and when it gets posted. The code-block window uses a fixed font which is not retained in the post.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

  • Sunday, March 18, 2012 1:15 PM
     
      Has Code

    And so finally, use the web UI, code block and the preview. Will this make any difference?

    SELECT t1.col1, t2.col2
    FROM   table1 t1
    WHERE  NOT EXISTS (SELECT * 
                               FROM   table3 t3
                               WHERE  t3.table2ID = t1.table2ID
                                  AND  t3.col3     = t1.col3)
    
    

    Well, in the preview I can see who the code will look with a proportional font, but actually trying to format the code so that it looks pretty with the proportional font is tedious.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

  • Sunday, March 18, 2012 11:27 PM
     
      Has Code

    Testing an old Excel Add-In that converts code to HTML.

    This is the SQL Statement converted to HTML

    SELECT t1.col1, t2.col2
    FROM   table1 t1
    WHERE  NOT EXISTS (SELECT *
                      FROM   table3 t3
                      WHERE t3.table2ID = t1.table2ID
                      AND  t3.col3      = t1.col3)

    Here is a VBA procedure converted to HTML

    SubFooBar()
    DimFoo As String

      Application.DoubleClick

      Foo = Application.Version
    ' just a test procedure
      MsgBox "Hello World - Version " & Foo

    EndSub

    And properly formatted code in a code block. Takes too long to do this, and the colours are mucked up...

    SubFooBar()
    DimFoo As String

      Application.DoubleClick

      Foo = Application.Version
    ' just a test procedure
      MsgBox "Hello World - Version " & Foo

    EndSub


    Ed Ferrero
    www.edferrero.com

    • Edited by Ed Ferrero Thursday, March 22, 2012 10:34 PM
    •  
  • Tuesday, March 20, 2012 6:52 PM
     
      Has Code
    1. asdfasdf
    SELECT t1.col1, t2.col2
    FROM table1 t1
    WHERE NOT EXISTS (SELECT *
    	FROM table3 t3
    	WHERE t3.table2ID = t1.table2ID
    		AND t3.col3 = t1.col3)

    1. asdfasdf

    Community Forums Program Manager

  • Wednesday, March 21, 2012 11:18 AM
     
     

    test


    Forums Administrator