Command Line Examples

Some examples of the command line input are as follows:

Analyzing the pubs database on the CS server and generate drop script with sqldrop.sql name:

ApexSQLClean.com /server:CS /database:pubs /output_format:SQLDROP /output_name:sqldrop.sql

Analyzing the pubs database on the ser server using connection options user and password and generate drop script with sqldrop.sql name:

ApexSQLClean.com /s:ser /u:mylogin /p:mypassword /database:pubs /output_format:SQLDROP /output_name:sqldrop.sql

Analyzing the pubs database on the CS server, generate HTML report with HTMLReport.htm name and overwrite output file if exist:

ApexSQLClean.com /d:pubs /output_format:HTML /output_name:C:\HTMLReport.htm /f

Analyzing a database using settings from project file ("My Project.xml") and analyzing file dependences in directory "D:\myprog" including subdirectory:

ApexSQLClean.com /output_format:SQLDROP /output_name:sqldrop.sql /file_dir:D:\myprog /include_subdir /Project:"My Project.axcl"

Analyzing a database using settings from project file ("My Project.xml"), generate drop script with sqldrop.sql name, override output file if exist, using verbose mode:

ApexSQLClean.com /output_format:SQLDROP /output_name:sqldrop.sql /Project:"My Project.axcl" /f /v

Execute ApexSQLClean with arguments specified in "argfile.xml" argfile:

ApexSQLClean.com /Argfile:argfile.xml

Analyzing pubs database using selection profile ("SelectionProfile.xml") and generate drop script with name SqlDrop.sql by default:

ApexSQLClean.com /d:pubs /i:SelectionProfile.xml

Analyzing only tables and views in the pubs database and generate drop script with name SqlDrop.sql by default:

ApexSQLClean.com /d:pubs /O:12

Analyzing only tables and views in pubs database, load dependency viewer settings (object shapes, colors, etc.) from DWOptions.xml file and generate image with "Dependency.bmp" filename (by default). The Objects layout is Orthogonal:

ApexSQLClean.com /d:pubs /O:12 /dv:DWOptions.xml /layout:o /output_format:bmp

Analyzing the mydb database, loading dependency viewer settings (object shapes, colors, etc) from DWOptions.xml and generate image for object dbo.LogTable with name Dependency.bmp by default. The Objects layout is Orthogonal. The diagram shows only the children objects:

ApexSQLClean.com /d:mydb /dv:DWOptions.xml /layout:o /dependency_type:co /output_format:bmp /object_name:LogTable /object_schema:dbo

Analyze complete AdventureWorks database, generate dependencies to a JPEG picture and output it to the specified file, use Hierarchy object layout on the picture, force file overwrite if it exists and display verbose information while processing.

ApexSQLClean /d:AdventureWorks /of:j /on:"c:\Temp\AWDep.jpg" /l:h /f /v

Analyze complete AdventureWorks database, generate dependencies to a GIF picture and output it to the specified file in the current working directory, use Circular object layout on the picture, force overwriting files that already exist, be verbose and write all processing information to "verbose.txt" file instead directly to the console output.

ApexSQLClean /d:AdventureWorks /of:g /on:"AWDep.gif" /l:c /f /v /out:"verbose.txt"

Analyze only Tables and Views in AdventureWorks database, generate dependencies for only one database object "Person.Address" to a PNG picture and output it to the specified file, use default object layout on the picture, force overwriting files that already exist and be verbose.

ApexSQLClean /d:AdventureWorks /o:12 /of:p /on:"c:\Temp\AWDep.png" /f /v /n:Address /os:Person

Analyze database Northwind on a local server instance named SQL2k, generate XML dependency report and output it to the specified file, include only children and parents count in the report and be verbose:

ApexSQLClean /s:localhost\SQL2k /d:Northwind /of:XML /on:"C:\Temp\Report.xml" /ro:icp icc /v

Analyze database Northwind on a local server instance named SQL2k, but only analyze functions and procedures (bitwise 17) and all files under "C:\inetpub" folder and its subfolders. Mind the comment delimiter "'" and multi-line comments beginning with "/*" and ending with "*/". Output dependency report in a form of HTML in the specified file in current directory, overwrite if it exists, show only Owners and Parents, be verbose and redirect all console output to file "results.txt":

ApexSQLClean /s:localhost\SQL2k /d:Northwind /o:17 /fd:"C:\inetpub" /is /cd:/*:*/ ' /of:HTML /on:"DepRep.html" /f /ro:io ip /v /out:"result.txt"

Analyze database Northwind on a local server instance named SQL2k, and analyze external database pubs and all files within and under directory "c:\inetpub". Generate a drop script for all un-referenced tables and views (bitwise 12). Write the script to the "DropScript.sql" file into current directory and be verbose while doing this:

ApexSQLClean /s:localhost\SQL2k /d:Northwind /on:"DropScript.sql" /o:12 /ex:pubs /fd:"c:\inetpub" /is /v

Similar example to the one above. In addition, only VB script and ASP files are analyzed, minding the "'" comment line delimiter, script has included header and comments and output file will be overwritten if it exists:

ApexSQLClean /s:localhost\SQL2k /d:Northwind /on:"DropScript.sql" /o:12 /ex:pubs /fd:"c:\inetpub" /is /fp:*.vbs *.asp /cd:' /so:hdr cmt /f /v

Analyze AdventureWorks database on a local server's default instance, generate JPG picture with hierarchical dependencies and specified name in the current working directory of all SQL Server 2000 standard object types – not including SQL Server 2005 object types (bitwise 4573) and be verbose while doing it:

ApexSQLClean /s:(local) /d:AdventureWorks /of:JPG /on:"AWDeps.jpg" /o:4573 /l:h /v

Analyze AdventureWorks database on a local server's default instance, generate JPG picture with dependencies with specified name, overwrite file if it already exists, be verbose, analyze only tables and views (bitwise 12) and show dependencies for all objects which names start with "Product" (note that regular expression is in quotes due to special character "^"):

ApexSQLClean /d:AdventureWorks /of:j /on:AWDep.jpg /f /v /o:12 /inc:8:"^Product"

Similar example to the previous one except that all tables containing "ProductModel" in their name will be excluded from the dependencies picture (first all tables starting with "Product" will be included and exclusion will be applied after that):

ApexSQLClean /d:AdventureWorks /of:j /on:AWDep.jpg /f /v /o:12 /inc:8:"^Product" /exc:8:ProductModel

Similar example to previous one except that no /include was specified so all objects are included by default. Three excludes are specified excluding all tables and views containing "Employee" and all tables containing "Product" in their name:

ApexSQLClean /d:AdventureWorks /of:j /on:AWDep.jpg /f /v /o:12 /exc:8:Employee 4:Employee 8:Product