sql formatting tool

  • Does sql server 2012 standard come w/ its own t-sql formatter? The third party tool I bought years ago doesn't support sq. server 2012 apparently

  • have you tried poorsql.com?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • No, there's no formatting of any kind built into SQL Server Management Studio. It does have syntax coloring, but that's it. Any formatting has to be done through other means.

    My personal favorite, and not just because I work for them, Red Gate SQL Prompt[/url]. It supports 2012 (and Azure and 2014).

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

  • Grant Fritchey (2/11/2014)


    No, there's no formatting of any kind built into SQL Server Management Studio. It does have syntax coloring, but that's it. Any formatting has to be done through other means.

    My personal favorite, and not just because I work for them, Red Gate SQL Prompt[/url]. It supports 2012 (and Azure and 2014).

    Seconded

    -------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
    There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
    I would never join a club that would allow me as a member - Groucho Marx

  • There are a few ones out there. Someone has done all the research work for you.

    http://dba.stackexchange.com/questions/45051/formatting-t-sql-in-ssms-2012

  • +1 for Poor Man's T-SQL Formatter. Free is affordable. I use a combination of tools.

    When I'm writing code in SSMS I use Red Gate SQL Prompt which is just pure magic, then I make it a point to run the Poor Man's Formatter just so that all my code ends up following the same format when it's checked in.

    If I'm formatting something for a document or blog post, I'm really enjoying the free Simple-Talk SQL Prettifier.

    Why is it that people who can't take advice always insist on giving it? - James Bond, Casino Royale

  • Grant Fritchey (2/11/2014)


    My personal favorite, and not just because I work for them, Red Gate SQL Prompt[/url]. It supports 2012 (and Azure and 2014).

    Sadly, at $350 per user, I don't think that I can convince my boss to let me buy SQL Prompt, although it does sound great. If it was $50, I'd buy it myself but a tool that is just needed for reformatting our Vendor's SQL Scripts so that I can work out what they are doing and fix the bugs or so that I can compare the Vendor's Version 2 Script with my fixed copy of their Version 1 Script is difficult to justify.

  • SimonHolzman (9/4/2014)


    Grant Fritchey (2/11/2014)


    My personal favorite, and not just because I work for them, Red Gate SQL Prompt[/url]. It supports 2012 (and Azure and 2014).

    Sadly, at $350 per user, I don't think that I can convince my boss to let me buy SQL Prompt, although it does sound great. If it was $50, I'd buy it myself but a tool that is just needed for reformatting our Vendor's SQL Scripts so that I can work out what they are doing and fix the bugs or so that I can compare the Vendor's Version 2 Script with my fixed copy of their Version 1 Script is difficult to justify.

    Completely understood. But, it does one heck of a lot more than just formatting. Download it & try it out. You can do that for free. Check out the snippets. They're extremely useful.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

  • Grant Fritchey (9/4/2014)


    [SQL Prompt] does one heck of a lot more than just formatting. Download it & try it out. You can do that for free. Check out the snippets. They're extremely useful.

    We don't do much development work, mostly fixes and ad hoc queries, which I have a stack of base code for already... I really do just need a comprehensive formatter. The only thing that might be a useful add-on is a compare utility, but I can usually do that by eye once the scripts are in the same format.

    Things like auto-complete drive me (more) insane - we have a table with a field called Country_Code and, until I disabled autocomplete, whenever I needed to do a count of the number of records, it would generate;

    SELECT Race, Country_Code

    FROM Person WITH (nolock)

    GROUP BY Race

    ORDER BY 2 DESC

    If RedGate can rip out the Formatter into a standalone SSMS extension for a more reasonable price, I suspect that they would make a (bigger) fortune.

  • SimonHolzman (9/4/2014)


    Grant Fritchey (9/4/2014)


    [SQL Prompt] does one heck of a lot more than just formatting. Download it & try it out. You can do that for free. Check out the snippets. They're extremely useful.

    We don't do much development work, mostly fixes and ad hoc queries, which I have a stack of base code for already... I really do just need a comprehensive formatter. The only thing that might be a useful add-on is a compare utility, but I can usually do that by eye once the scripts are in the same format.

    Things like auto-complete drive me (more) insane - we have a table with a field called Country_Code and, until I disabled autocomplete, whenever I needed to do a count of the number of records, it would generate;

    SELECT Race, Country_Code

    FROM Person WITH (nolock)

    GROUP BY Race

    ORDER BY 2 DESC

    If RedGate can rip out the Formatter into a standalone SSMS extension for a more reasonable price, I suspect that they would make a (bigger) fortune.

    I don't think it does everything, but you might check this out. The price is right.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

  • http://www.apexsql.com/sql_tools_refactor.aspx

    see above link...its free, but requires you to set up your preferences....can be a bit awkward for fine tuning

    I prefer Red Gate...but as freelance cant justify the cost

    maybe be helpful....and I have no associations with Apex

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • Grant Fritchey (2/11/2014)


    No, there's no formatting of any kind built into SQL Server Management Studio. It does have syntax coloring, but that's it. Any formatting has to be done through other means.

    My personal favorite, and not just because I work for them, Red Gate SQL Prompt[/url]. It supports 2012 (and Azure and 2014).

    Made my boss buy it for me and it has made me so much more productive, both because I'm awful at memorizing syntax (can only remember concepts), and because of the many things it auto-completes/suggests. I think it over-formats some CTEs and APPLY expressions, but that's just a matter of preference.

    Thanks

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

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