How to format a query

  • How to format a query in Microsoft SQL Server Management Studio 2008 R2.

    I dont see any format query kind of menu.

    Is there any way ?

    I have a query which is one line ...I find it difficult to read.

    I want to format it in a structured way ....better readability

  • Are you talking about changing the font and the background colour, etc? If so take a look at Tools > Options > Fonts and Colors.

  • Are you talking about changing the font and the background colour, etc? If so take a look at Tools > Options > Fonts and Colors.

  • SSMS does not format queries or their results. You need to format the query manually.

    You should use something like .NET to get and format the results.

  • Are you lookin for following link?

    http://sql-format.com/

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • I want to format sql query.

  • You need to tell us what you mean by that because it's not clear.

  • If you have T-SQL code you want formated, show use the code.

  • >>>>http://sql-format.com/

    yes. This is what I need.

    thanks

  • Another option is to use http://poorsql.com

    It has SSMS and notepad++ plugins plus, plus a stand-alone formatter.

    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
  • If you don't mind spending a little money, Red Gate SQL Prompt[/url] is a tool that I can't live without. It formats your code. And it provides code completion way above and beyond that available in SSMS, plus code snippets, tab history, all kinds of joy.

    DISCLAIMER: I gleefully work for Red Gate.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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