ErikEJ.DacFX.TSQLAnalyzer.Cli
1.0.10
Prefix Reserved
dotnet tool install --global ErikEJ.DacFX.TSQLAnalyzer.Cli --version 1.0.10
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local ErikEJ.DacFX.TSQLAnalyzer.Cli --version 1.0.10
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=ErikEJ.DacFX.TSQLAnalyzer.Cli&version=1.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package ErikEJ.DacFX.TSQLAnalyzer.Cli --version 1.0.10
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
T-SQL Analyzer CLI
T-SQL Analyzer is a command line tool for identifying, and reporting the presence of anti-patterns in T-SQL scripts.
It evaluates more than 140 rules for design, naming and performance issues.
Getting started
The tool runs on any system with the .NET 8.0 runtime installed.
Installing the tool
dotnet tool install --global ErikEJ.DacFX.TSQLAnalyzer.Cli
Usage
# Analyze all .sql scripts in current folder and sub-folders
tsqlanalyze
## Analyze a single file
tsqlanalyze -i C:\scripts\sproc.sql
## Analyze a folder
tsqlanalyze -i "c:\database scripts"
## Analyze a folder with a filter and a full folder path
tsqlanalyze -i c:\database_scripts\sp_*.sql "c:\old scripts"
## Analyze a script with a rule settings filter and for a specific SQL Server version
tsqlanalyze -i C:\scripts\sproc.sql -r Rules:-SqlServer.Rules.SRD0004 -s SqlAzure
## Analyze a .dacpac
tsqlanalyze -i C:\scripts\Chinook.dacpac
## Analyze a live database
tsqlanalyze -c "Data Source=.\SQLEXPRESS;Initial Catalog=Chinook;Integrated Security=True;Encrypt=false"
Rule settings filters are demonstrated here
The SQL Server version values are documented here
Sample output
The tool will output a summary of the rules that were violated, and the line numbers where the violations occurred.
Table3.sql:
CREATE TABLE [dbo].[Table3]
(
[Id] INT NOT NULL,
[Wang] NCHAR(500) NOT NULL,
[Chung] NCHAR(10) NOT NULL
)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
1.0.10 | 253 | 2/24/2025 |
1.0.9 | 124 | 2/24/2025 |
1.0.8 | 141 | 2/23/2025 |
1.0.7 | 250 | 2/19/2025 |
1.0.5 | 151 | 2/19/2025 |
1.0.0-preview.4 | 174 | 2/17/2025 |
0.9.174-nightly | 106 | 2/16/2025 |
0.9.171-nightly | 130 | 2/16/2025 |
0.9.169-nightly | 130 | 2/16/2025 |
0.9.167-nightly | 110 | 2/15/2025 |
0.9.166-nightly | 108 | 2/15/2025 |
0.9.164-nightly | 118 | 2/15/2025 |
0.9.156-nightly | 105 | 2/15/2025 |
0.9.154-nightly | 109 | 2/15/2025 |
0.9.152-nightly | 116 | 2/15/2025 |
0.9.151-nightly | 113 | 2/15/2025 |
0.9.150-nightly | 101 | 2/15/2025 |
0.9.149-nightly | 121 | 2/15/2025 |
0.9.141-nightly | 121 | 2/14/2025 |
0.9.139-nightly | 112 | 2/14/2025 |
0.9.137-nightly | 92 | 2/12/2025 |
0.9.135-nightly | 87 | 2/12/2025 |
Initial release