SQL Compare 9

Command line basics

This page provides information on the following aspects of the SQL Compare command line:

For details and examples of all of the switches that are available for the SQL Compare command line, see Switches used in the command line

Getting help

To display a brief description of SQL Compare, and basic help on all the command line switches, enter:

sqlcompare /help

For more detailed help enter:

sqlcompare /help /verbose

This displays a detailed description of each switch and the values it can accept (where applicable), and all exit codes. To output the help in HTML format, enter:

sqlcompare /help /verbose /html

Entering a command

When you enter a command, the order of switches is unimportant.

We recommend you follow the Microsoft convention of separating a switch from its values using a colon as shown below.

/Out:Output.txt

Values that include spaces must be delimited by double quotation marks ( " ). For example:

/Out:"c:\Output_File.txt"

Note that if you delimit a path with double quotation marks, you must not terminate the path with the backslash character ( \ ), because the backslash will be interpreted as an escape character. For example:

Incorrect:

/Location:"C:\Packages\"

Correct:

/Location:"C:\Packages"

For switches that accept multiple values, use commas to separate the values. For example:

/options:IncludeDependencies,ForceColumnOrder

For switches that accept a compound value, separate each part of the value using a colon.

For example, the /include and /exclude switches are used to include and exclude objects from the comparison and synchronization:

/Include:table:Product

This includes all tables for which the table name contains the word Product.

Aliases

Many of the switches have an alias. The alias provides a convenient short-hand way to specify the switch. For example, /? is the alias for the /help switch, and /v is the alias for the /verbose switch.

Switches and aliases are not case sensitive.

The /Options switch

You can use the /Options switch to change your options. For example, comparisons are not case-sensitive by default; to specify case sensitive comparisons you would use the /Options switch:

/Options:CaseSensitiveObjectDefinition

However, note that if you set any options explicitly, all of the default options are switched off.

For more information about options, and a list of default option settings, see: Options used in the command line.

Verbose and quiet switches

The standard output mode prints basic information about what the tool is doing while it is executing. You can specify verbose and quiet modes using the /verbose and /quiet switches, respectively. In verbose mode, detailed output is printed; in quiet mode, output is printed only if an error occurs.

Redirecting command line output

The command line output can be redirect using either the /Out switch, or the output redirection features provided by the shell in which you are executing the command.

Using /Out

You can use the /out switch to specify the file to which you want output directed:

sqlcompare ... /Out:OutputLog.txt

where OutputLog.txt is the name of the file. If the file exists already, you must also use the /Force switch to force the tool to overwrite the file, otherwise an error will occur.

Other redirection

From the standard command prompt provided by Windows, you can redirect output to a file as follows:

sqlcompare ... > OutputLog.txt

Note that the redirection operator ( > ) and file name must be the last items on the command line.

If the specified file exists already, it will be overwritten. To append output from the tool to an existing file, enter the following:

sqlcompare... >> existinglog.txt

This adds the output to the existing file content, without data being lost.

If you are scripting using a language such as VBScript, JScript, PHP, Perl, or Python, or if you want to access the tool from Web pages using ASP.NET, refer to the documentation for the language.

Specify command line arguments in an XML file that can be referenced using the /Argfile switch. For more on this topic see: Using XML to specify command line arguments.


 


Didn't find what you were looking for?