How do I run code analysis against a deployed database from a command line
IanG
Posts: 2 New member
I want to be able to run a code analysis of all objects deployed to a SQL Server 2016/17 database and produce a report of all the warnings or errors, using a command line. I have not been able to find any clear examples of doing this with the latest versions of SQL Change Automation/SQL Prompt.
Can someone point me in the right direction please?
Can someone point me in the right direction please?
Tagged:
Answers
So, if my server is MyServer, database is MyDB, I want the code anaylsis results output to a file C:\CAResults.txt and the code analysis rules are in a file C:\CodeAnalysisSettings.casettings, what should my PowerShell command line look like?
The path for output files is a parameter for Export-DatabaseReleaseArtifact
https://documentation.red-gate.com/sca3/reference/powershell-cmdlets/new-databasereleaseartifact
https://documentation.red-gate.com/sca3/reference/powershell-cmdlets/new-databaseconnection
https://documentation.red-gate.com/sca3/reference/powershell-cmdlets/export-databasereleaseartifact