Avoid T-SQL anti-patterns with the free T-SQL analysis tool

T-SQL Analyzer: A Tool to Avoid T-SQL Anti-Patterns
Installation
- The tool is a .NET 8 tool and requires the .NET 8 runtime to be installed.
- Running the tool from the command prompt in any folder will analyze all .sql files in that folder and sub-folders.
- The tool outputs a summary of the rules violated and the line numbers where the violations occurred.
- Use
tsqlanalyze -h
for help on available options. - To analyze a single file:
tsqlanalyze -s [path to file]
Advanced Usage
Ignore Rules
- Exclude specific rules from analysis by adding a rule exclusion filter to the command line.
Format Script
- The tool can format your script using the
-f
option.
Other Advanced Options
- Analyze a .dacpac file or a live database.
- Output analysis results in XML format.
- Integration with SQL Server Management Studio and Visual Studio.
VS Code MCP Server (preview)
- Use the tool to ask GitHub Copilot to analyze your SQL Server CREATE scripts in Visual Studio Code by adding the built-in MCP server to your VS Code configuration.
- Automatic installation:
vscode:mcp/install?%7B%22name%22%3A%22tsqlanalyzer%22%2C%22command%22%3A%22tsqlanalyze%22%2C%22args%22%3A%5B%22-mcp%22%5D%7D
- Manual installation:
tsqlanalyze -mcp
- Automatic installation:
Parting Words
- The T-SQL Analyzer is a free, open-source tool for identifying anti-patterns and design issues in SQL Server T-SQL scripts.
- Reach out via the GitHub repository with any feedback.
- Happy SQL coding!