Format SQL (Pro)

  • I tried Format SQL (Pro) and I really liked it.

    Unfortunately I will probably not be able to get it funded.

    There are some Free SQL Formatting Tools.

    Has anyone used any of them and if so what is your preferred tool?

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • SQL formatting is important for me, and i tested the RedGate tools, which are really nice, but they were more than I wanted to spend.

    I ended up purchasing "SQL Pretty Printer for SSMS" for $50 dollars; it shows up inside SSMS as a menu item named "SQL Beautifier" with multiple options.

    you can get the demo SSMS add in from http://www.dpriver.com and evaluate it yourself; it's got a lot of formatting options to tune it to your own specific style.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Cool thanks Lowell.

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • I tried the free version of SQL Pretty Printer for SSMS but it did not format very well.

    I tried a few other free formatting tools as listed at the following URL:

    http://stackoverflow.com/questions/3310188/what-free-sql-formatting-tools-exist

    I found Poor Man's T-SQL Formatter to be the best of the options listed in the blog.

    It formatted just as well as SQL Format (Pro).

    http://architectshack.com/PoorMansTSqlFormatter.ashx#Download_8

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • http://poorsql.com is a free online one that seems to work fairly well.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Pretty formatting is one small feature to be spending $50 on it. I bought QuickMacros for $40 and wrote about 20 custom functions to use in SSMS. They all work on a selection of text.

    Here is what I wrote for ssms so far:

    Format SQL. It's about 95% perfect and I can write different styles of it.

    Convert a horizontal column list to vertical and vice-versa.

    Convert spaces to tabs.

    Remove spaces and tabs before CrLfs.

    Strip brackets from a selection (I don't allow reserved words as column names).

    Delete "null" and "not null" words from a list of columns.

    Delete data types from a list of columns.

    Count characters selected and number of lines.

    Sort result rows.

    Remove duplicate lines.

    Strip underscores.

    Do "cut+append", "copy+append", and "paste swap".

    TitleCase, CamelCase, ProperCase, and upper or lower case a selection.

    Upcase T-SQL keywords.

    And my all time favorite: convert the selected text to match the case of table and column names in the database...since coders are lazy and type only lowercase.

  • @bill 😎

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • I'm personally interested in this. I'd love to see a full post on how this works for you, time invested vs time saved. Formatting through the macros has to be interesting. How does it work for you, any examples? Please IM me if you create an article/post on this. Sounds really interesting!

  • i installed both tools mentioned in this post the http://poorsql.com and http://www.dpriver.com, and between them both probably use them two dozen times a day.

    there are subtle style differences between the two, so i often use both on the same snippet of code to decide which i like better.

    Also, pretty much every post I put on SSC has code attached to it, and i make sure it is formatted for readability with the same tools as well. I also create a TSQL proc that standardizes a CREATE TABLE to a specific format as well. between those three things, i get nice looking, standard looking code day in and day out.

    I feel like i did something right when i write some code, run one of the formatting tools, and there was no changes(because i typed it the way i expect the end results the be anyway)

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 9 posts - 1 through 8 (of 8 total)

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