Skip to content
| Marketplace
Sign in
Visual Studio>Tools>OTA Sql Formatter
OTA Sql Formatter

OTA Sql Formatter

Jeevathanan

|
6 installs
| (0) | Free
Open To All Sql Formatter
Download

OTA SQL Formatter - User Guide

Supported Files

The formatter works with SQL files opened in Visual Studio:

  • .sql files
  • .txt files containing SQL code

How to Use

  1. Open a SQL file in Visual Studio
  2. Click on the Tools menu at the top
  3. Select "OTA Sql Formatter" from the menu
  4. Your SQL code will be automatically formatted according to your settings
Note: The formatter processes the entire document content and replaces it with the formatted version.

Configuration Settings

Access formatting options through Tools → Options → OTA Sql Formatter

Keyword Formatting

Keyword Case

  • Options: UPPER, Lower, Title
  • Default: UPPER
  • Example:
    • UPPER: SELECT * FROM users WHERE active = 1
    • Lower: select * from users where active = 1
    • Title: Select * From Users Where Active = 1

Indentation Settings

Spaces Per Indent

  • Default: 4 spaces
  • Description: Number of spaces for each indentation level
  • Range: Any positive integer

Initial Indent Level

  • Default: 0
  • Description: Starting indentation level for formatted SQL
  • Use Case: Set starting indentation when embedding SQL in other code

Comma Formatting

Comma Positioning (Columns & IN Lists)

  • Options: CommaFirst, CommaLast
  • Default: CommaFirst
CommaFirst CommaLast
SELECT 
     column1
    ,column2
    ,column3
FROM table
SELECT 
    column1,
    column2,
    column3
FROM table

Conditional Statements (WHERE Clause)

Condition Break Style

  • Options: BreakEachCondition, Inline
  • Default: BreakEachCondition
  • Description: Controls how WHERE conditions are formatted
BreakEachCondition Inline
WHERE status = 'active'
    AND age > 18
    AND country = 'USA'
WHERE status = 'active' AND age > 18 AND country = 'USA'

Logical Operator Placement

  • Options: OperatorAtStart, OperatorAtEnd
  • Default: OperatorAtStart
  • Description: Controls placement of logical operators (AND, OR)
OperatorAtStart OperatorAtEnd
WHERE status = 'active'
    AND age > 18
    AND country = 'USA'
WHERE status = 'active' AND
    age > 18 AND
    country = 'USA'

Condition Indent Level

  • Default: 0
  • Range: 0 or higher (enforces minimum of 0)
  • Description: Indent level for conditions after the first (AND/OR continuation lines)

JOIN Formatting

ON Keyword Placement

  • Options: SameLine, NewLine
  • Default: SameLine
  • Description: Controls whether ON keyword appears on same line as JOIN or on a new line
SameLine NewLine
INNER JOIN orders ON 
    orders.user_id = users.id
INNER JOIN orders
    ON orders.user_id = users.id

JOIN Condition Break Style

  • Options: Inline, BreakEachCondition
  • Default: BreakEachCondition
  • Description: Controls how JOIN ON conditions are formatted
  • Example:
INNER JOIN orders ON orders.user_id = users.id
    AND orders.status = 'active'
    AND orders.total > 100

Function Formatting

Multiline Function Arguments

  • Default: false (single line)
  • Description: Break function arguments into multiple lines
Single Line (false) Multiline (true)
CONCAT(firstName, ' ', lastName)
CONCAT(
     firstName
    ,' '
    ,lastName
)

List Formatting

Enable List Formatting

  • Default: false
  • Description: Enable special formatting for SQL lists
  • Applies to: IN clause, CREATE TABLE columns, INSERT VALUES

Items Per Row

  • Default: 0 (one item per row)
  • Description: Number of items per row in lists. Set to 0 to disable (one per row)
  • Example with Items Per Row = 3:
WHERE id IN (1, 2, 3,
             4, 5, 6,
             7, 8, 9)

Profiles & Team Settings

The formatter supports profile management through Visual Studio's options system. Share consistent formatting across your team:

  1. Configure your preferences in Tools → Options → OTA Sql Formatter
  2. Export settings: Tools → Import and Export Settings → Export selected environment settings
  3. Share with team: Distribute the .vssettings file
  4. Import profiles: Tools → Import and Export Settings → Import selected environment settings

Best Practices

Recommended Team Settings

For consistent, maintainable SQL code across your team:

Setting Recommended Value Reason
Keyword Case UPPER Distinguishes keywords from identifiers
Comma Positioning CommaFirst Better version control diffs
Condition Break Style BreakEachCondition Improves readability of complex conditions
Spaces Per Indent 4 Industry standard
Logical Operator Placement OperatorAtStart Modern SQL style guides

When to Format

  • Before committing code to version control
  • After importing legacy SQL scripts
  • When reviewing complex queries
  • Before sharing SQL with team members

Troubleshooting

Extension Not Appearing in Tools Menu

  1. Verify installation: Go to Extensions → Manage Extensions, check if OTA SQL Formatter is installed and enabled
  2. Restart Visual Studio completely
  3. Check file type: Ensure you have a .sql or .txt file open

Formatting Not Working

  1. Check file validation: The formatter validates the document before processing
  2. Review error messages: Look for validation warnings in the output window
  3. Verify file content: Ensure the file contains valid SQL syntax

Updating Settings

Changes to formatting options take effect immediately—no Visual Studio restart required.

Requirements

  • Visual Studio 2019 (16.x) or Visual Studio 2022 (17.x)
  • .NET Framework runtime (included with Visual Studio)
  • SQL or text files for formatting

OTA SQL Formatter v1.0 | Open To All SQL Formatter

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft