SQL Change Automation v3.1 now includes static code analysis for SQL, which gives you advice on errors and best practices when deploying changes to a database.
The new “SQL Code Issues” tab on the Release Report lists any issues and shows all the rules that were checked and passed for both SQL Source Control and SQL Change Automation projects.
![]()
![]()
![Image: /hc/user_images/01JK89N0TTJ64RAMCD17MHX28M.png]()
The SQL code analysis checks rules in the following categories:
Code Analysis was introduced in SQL Prompt v9. This shows you any issues as you type in SSMS or VS. This is shifted-left as far as possible to help catch issues before they are released. Having the static code analysis run at deployment time catches any issues not fixed at development time and gives DBAs additional confidence in the release scripts. If there are any issues, it will NOT fail a build or block a release. It’s additional information for the DBA to review.
To get the latest version, update your SQL Change Automation PowerShell. If you are using the SQL Change Automation add-ons (Azure DevOps, TFS, Octopus Deploy, and more), then they’ll automatically get the latest PowerShell version if the release agent has internet access. You should just see the new “SQL Code Issues” tab when you create your next release.
Please feel free to share this in blogs/tweets. Or, even better, give it a try and let us know what you think.
SQL Change Automation v3.1 now includes static code analysis for SQL, which gives you advice on errors and best practices when deploying changes to a database.
The new “SQL Code Issues” tab on the Release Report lists any issues and shows all the rules that were checked and passed for both SQL Source Control and SQL Change Automation projects.
Best practice rules — Adhere to good industry practices.
Deprecated syntax rules — T-SQL keywords or syntax discontinued by Microsoft.
Execution rules — Identify issues that may be problematic upon execution.
Naming convention rules — Naming convention rules
Performance rules — Use of SQL that could cause performance problems.
Script rules — Issues to do with the SQL script and not the SQL itself.
Style rules — Code style issues.
Miscellaneous rules — Rules that don't fall under one of the other categories.
For more information about the rules, see https://documentation.red-gate.com/codeanalysis.
Code Analysis was introduced in SQL Prompt v9. This shows you any issues as you type in SSMS or VS. This is shifted-left as far as possible to help catch issues before they are released. Having the static code analysis run at deployment time catches any issues not fixed at development time and gives DBAs additional confidence in the release scripts. If there are any issues, it will NOT fail a build or block a release. It’s additional information for the DBA to review.
To get the latest version, update your SQL Change Automation PowerShell. If you are using the SQL Change Automation add-ons (Azure DevOps, TFS, Octopus Deploy, and more), then they’ll automatically get the latest PowerShell version if the release agent has internet access. You should just see the new “SQL Code Issues” tab when you create your next release.
If you want to control which rules run, see how on “Configuring the Code Analysis rules.”
Please feel free to share this in blogs/tweets. Or, even better, give it a try and let us know what you think.
Thank you!