ApexSQL Clean Command Line Interface (CLI) switches

Applies to
ApexSQL Clean

Summary
This article explains the ApexSQL Clean CLI switches and their usage through examples.

Description

Connection switches

/server Specifies a server and instance name to connect to
Alias /s
Format: /server:server_name[\instance_name]
Quick tip icon

Quick tip:

If the server is not specified the “(local)” instance is assumed.

/database Specifies the name of a database to connect to
Alias /d
Format: /database:database_name
/login Specifies login for SQL Server authentication
Alias /u
Format: /login:login
Note: You must use this option together with /password switch
Quick tip icon

Quick tip:

If a user is not specified a trusted connection is assumed.

/password Specifies login’s password when using SQL Server authentication
Alias /p
Format: /password:password
Note: You must use this option together with the /login switch

Export options

/output_format Specifies the output format of the report, or the image format of graphical dependencies. Arguments cannot be combined.
Arguments:
XML [x] – XML report
SQLDrop [s] – SQL drop script
HTML [h] – HTML report
BMP [b] – BMP image format
JPG [j] – JPG image format
PNG [p] – PNG image format
GIF [g] – GIF image format
Alias /of
Format: /output_format:argument
Quick tip icon

Quick tip:

If the output format is not specified the SQL format is set by default.

/output_name Specifies the output file name of the report, or the file name of the image of graphical dependencies.
Alias /on
Format: /output_name:output_name
Quick tip icon

Quick tip:

If an output file name is not specified, assumed names are:

  • SQLDrop.sql for SQL output format
  • Report.html for HTML output format
  • References.xml for XML output format
  • Dependency.(bmp | png | gif | jpg) with the appropriate extension for the selected output format.

Specific options:

/project Specifies a project file path
Alias /pr
Format: /project:project_file_path
/object_types Specifies a bitwise set of object type constants
Alias /o
Format: /object_types:bitwise_set
/include Includes specific objects in the comparison process. Objects can be specified by first specifying a bitwise set and a regular expression.
Multiple includes can be specified with spaces in between.
Alias /inc
Format: /include:bitwise_constant:regular expression
/exclude Excludes specific objects from the comparison process. Objects can be specified by first specifying a bitwise set and a regular expression.
Multiple excludes can be specified with spaces in between.
The /exclude switch is processed after the /include switch (if it is specified).
Alias /exc
Format: /exclude:bitwise_constant:regular expression
Quick tip icon

Quick tip:

The /exclude switch and its arguments are processed after the /include switch, if it is specified.

/external_databases Specifies databases for analysis of external references.
Alias /ex
Format: /external_databases:Test_database1 Test_database2
/file_dir Specifies the directory where files for analysis of external reference are stored.
Alias /fd
Format: /file_dir:directory_path
/include_subdir Specifies if to include subdirectories in pattern search
Alias /is
Format: /include_subdir
/filename_patterns Specifies file name patterns of files for analysis of external reference.
Alias /fp
Format: /filename_patterns:argument
/comment_delimiters Specifies delimiters for comments that will be ignored and are associated with the client program for file analysis. To specify multi-line comment “:” symbol is used, and space to specify multiple comments. Comment delimiters are placed inside quotation marks.
Alias /cd
Format: /comment_delimimiter:argument
/search_settings Specifies a database search settings. Arguments can be combined.
Arguments:
WholeWordSearch [w] – match whole word only
IgnoreTrigger [t] – ignores the trigger reference to parent table
CaseSensitive [c] – use case sensitive search for SQL objects
None [n] – no settings
Default [d] – default settings
Alias /ss
Format: /search_settings:argument
Quick tip icon

Quick tip:

The WholeWordSearch setting will be used if the switch is omitted.

/report_options Specifies report options. Arguments can be combined.
Arguments:
IncludeChildren [ic] – include children objects
IncludeParents [ip] – include parent objects
IncludeColumnLevelDepenedencies [ilp] – include column level dependencies of objects
IncludeOwners [io] – include owner of objects
IncludeCountOfChildren [icc] – include count of children of parent object
IncludeCountOfParents [icp] – include count of parent objects
IncludeCounfOfDatabaseReferences [icd] – include count of database references of external connections
IncludeCountOfFileReferences [icf] – include count of file references of external connections
Default [d] – default options
None [n] – no report options
Alias /ro
Format: /report_options:argument
/script_options Specifies optional script elements. Arguments can be combined.
Arguments:
IncludeHeader [hdr] – include script header
IncludeComments [cmt] – include comments
IncludePrint [prt] – include print statements
IncludeTransactionHandling [trn] – include transaction handling
Default [d] – default options
None [n] – no optional script elements
Alias /so
Format: /script_options:argument
/backup Allows providing the path for the destination backup to be saved to a specific location, or:
None [n] – Prevents the backup from being created
Default [d] – Saves the backup in the installation folder
Alias /bu
Format: /backup:backup_path

Graphical dependencies options:

/dependency_type Specifies dependency type included in the graphical display. Arguments cannot be combined.
Arguments:
ChildrenOnly [co] – shows the object and its children
Descendants [ds] – shows the objects plus all descendants, including children and grandchildren
ParentAndChildrenOnly [pc] – shows the object plus its parents and children
ParentAndDescendants [pd] – shows all objects, including parents, children, and descendants
Alias /dt
Format: /dependency_type:argument
Quick tip icon

Quick tip:

The ParentAndDescendants setting will be used if the switch is omitted.

/layout Specifies the layout model type. Arguments cannot be combined.
Arguments:
CircularLayout [c] – depicts objects in a circle
ForceDirectedLayout [f] – layout most used objects in the center with least used on the outside
HierarchicalLayout [h] – orders objects with parents at the top and descendants at the bottom with each generation sharing the same vertical level
OrthogonalLayout [o] – lays out items in such a way that they are right-angled to each other
Alias /l
Format: /layout:argument
Quick tip icon

Quick tip:

The Force directed layout will be used if the switch is omitted.

/depviewer_options Specifies dependency viewer options path
Alias /dv
Format: /depviewer_options:options_path
/object_name Specifies the object name
Alias /n
Format: /object_name:object_name
/object_schema Specifies the object owner/schema
Alias /os
Format: /object_schema:schema_name

Additional options:

/help Prints help message
Alias /?
Format: /help
/argfile Specifies an XML file with preset options
Alias /af
Format: /argfile:argument_filename
/console_width Specifies the width of console output
Alias /cw
Format: /console_width:argument
/force Overrides existing file of same name
Alias /f
Format: /force
/out_to Redirects console output to specified file
Alias /out
Format: /out_to:argument
/test Outputs parsed command line switches without taking any actions
Alias /t
Format: /test
/verbose Prints messages during execution of command line switches that are suppressed by default.
Alias /v
Format: /verbose

Examples with common switches:

Quick tip icon

Quick tip:

All examples assume that the current directory is the application directory. If not, the full path to ApexSQLClean.com must be specified.

Loading a project file and creating SQL drop script with default settings.

ApexSQLClean.com /pr:project.axcl

Using a premade argument file with switches.

ApexSQLClean.com /af:C:\User\Nojro\Desktop\settings.xml

Create SQL drop script with default settings, using credentials to connect to a database.

ApexSQLClean.com /s:Nojro-pc /d:AdventureWorks2014 /u:Nojro /p:pwd123 /v /f

Create HTML report for the Adventure Works 2014 database, including parent and child dependencies with owner included, using case sensitive search options.

ApexSQLClean.com /d:AdventureWorks2014 /ro:ip ic io /ss:c /of:h /v /f

Create a XML report named Repo2 of the Adventure Works 2014 database that includes count of file references of external connections

ApexSQLClean.com /d:AdventureWorks2014 /ro:icf /of:x /on:Repo2 /v / f

Create full graphical display of object dependencies in the Adventure Works 2014 database in JPG.

ApexSQLClean.com /d:AdventureWorks2014 /of:j /v /f

Create graphical display of parents and descendants in the Adventure Works 2014 database in BMP file format, using case sensitive search options.

ApexSQLClean.com /d:AdventureWorks2014 /of:b /ss:c /dt:pd /v /f

Create SQL drop script named AW_D checking external connections with two databases, including script headers and print statements into drop script. Case sensitive search is used, without backup.

ApexSQLClean.com /d:AdventureWorks2014 /ex:AdventureWorks2008 AdventureWorks2012 /so:hdr prt /ss:c /of:s /on:AW_D /bu:n /v /f

Create the SQL drop script named EXT_DEP with checking the external file associations located on the Desktop in a database, including the subdirectories, with ignoring the trigger reference to the parent table option.

ApexSQLClean.com /d:AdventureWorks2014 /fd:C:\User\Nojro\Desktop /is /ss:t /of:s /on:EXT_DEP /v /f

Create the SQL drop script named FL_EXT with checking the external file associations located on the Desktop in a database, including the subdirectories, while checking only files with .txt extension.

ApexSQLClean.com /d:AdventureWorks2014 /fd:C:\User\Nojro\Desktop /is /fp:txt /of:s /on:FL_EXT /v /f