Code snippets removing line spaces

  • I just posted a topic in the SQL 2012 T-SQL forum group and the board removed all the line spaces between sections of code, making (to my eyes) what I posted completely unreadable. It's hard to tell one line from another, even though when I go to edit the post, the code box shows my line breaks and therefore renders the code more readable again.

    Can someone look into this? https://www.sqlservercentral.com/forums/topic/converting-substring-to-datetime-extra-eyes-please

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Can you post an image of what you want this to look like? From your description, it's hard to decide what things you want changed. We added scrolling, so there isn't a need to break lines. Do you mean lines between lines of code? In SSMS, there's often essentially a "br" break, not a "p" paragraph break.

     

  • I was just trying it out....if you have a chunk of sql and then have several cr/lf, those lines just disappear so the code is all together instead of having the empty lines for readability. Like a section declaring variables, then a few empty lines then some code, it ends up with no empty lines in between. Just one line after another with no empty lines. If you put them in the editor, paste from SSMS, paste from notepad, I didn't find a way to have the empty lines. Something like:

    DECLARE @SomeVar int = 5

     

     

    SELECT @SomeVar

    displays as

    DECLARE @SomeVar int = 5

    SELECT @SomeVar

     

    Sue

     

     

  • Well...I can't get it to show correctly on pasting....sorry about that. But the empty lines are removed and it does make things less readable. Brandi's example has no spaces and I would guess she had breaks in there for readability.

  • Hmm, OK, let me try something.

    SELECT *
    FROM dbo.Articles AS a
    GO


    -- two line breaks before this
    -- Test as SallyDev
    EXECUTE AS USER = 'SallyDev'
    SELECT *
    FROM dbo.Articles AS a
    REVERT
    GO

    -- one line break before here
    -- Grant permissions
    GRANT SELECT, INSERT ON dbo.Articles TO SallyDev
    GO

    -- Re-test as SallyDev
    EXECUTE AS USER = 'SallyDev'
    SELECT *
    FROM dbo.Articles AS a
    REVERT
    GO
  • OK, I think we have this filed somewhere, but I'll check on it.

  • Sorry I didn't have a chance to respond yesterday. It was very busy at work.

    But yes, that's exactly my problem. What Sue said and what you posted.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • This was driving me nuts too.  I tried a few things in post to see if there was a way around it but I think I edited one too many times.  Now the post is deleted...lol


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • Another test here, a partial (or whole) fix is in:

    SELECT *
    FROM dbo.Articles AS a
    GO


    -- two line breaks before this
    -- Test as SallyDev
    EXECUTE AS USER = 'SallyDev'
    SELECT *
    FROM dbo.Articles AS a
    REVERT
    GO

    -- one line break before here
    -- Grant permissions
    GRANT SELECT, INSERT ON dbo.Articles TO SallyDev
    GO

    -- Re-test as SallyDev
    EXECUTE AS USER = 'SallyDev'
    SELECT *
    FROM dbo.Articles AS a
    REVERT
    GO
  • 🙂

  • Danke!

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • --That's Great News!

    --Thanks ;)


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply