Alias: /bks1
If you are comparing a backup set that contains multiple files, use the /BackupSet1 switch to specify the files which make up the source backup set, and use the /BackupSet2 switches to specify the files which make up the target.
sqlcompare /Backup1:"D:\MSSQL\BACKUP\WidgetDev.bak" /BackupSet1:"2008-09-23 Full Backup" /db2:WidgetLive |
If the backup set switches aren't specified, SQL Compare uses the latest backup set.
To specify more than one backup file, the file names are separated using semi-colons.
sqlcompare /Backup1:D:\BACKUPS\WidgetDev_Full.bak; "D:\BACKUPS\WidgetDev_Diff.bak" /db2:WidgetDevlopment |
For encrypted backups that have been created using SQL Backup, use the /BackupPasswords1 and /BackupPasswords2 switches to specify the passwords; when there is more than one password, the passwords are separated using semi-colons.
sqlcompare /Backup1:D:\BACKUPS\WidgetDev.sqb /BackupPassword1:Pa$$w0rd /db2:WidgetLive |
Alias: /bks2
Specifies which backup set to use for the target backup.
sqlcompare /db1:WidgetProduction /BackupSet2:"2008-09-23 Full Backup" |
Alias: /db1
Specifies a database to use as the source.
sqlcompare /Database1:WidgetStaging /Database2:WidgetProduction |
Alias: /db2
Specifies a database to use as the target.
This switch is case sensitive. |
Attempts to deactivate the application. An internet connection is required to deactivate the product.
We recommend using filters instead of /Exclude. For more information, see Using filters. |
| only those objects that aren't present in the source (eg /db1) |
| only those objects that aren't present in the target (eg /db2) |
| only those objects that aren't present in both data sources, but are different. |
| identical objects in the command line output and any generated reports. |
| objects you specify with a regular expression (eg /include:Table:WidgetPurchases) |
To specify the list of objects to exclude, use the /exclude switch.
sqlcompare /db1:Customers1 /db2:Customers2 /exclude:table |
specifies that you don't want to compare tables; you only want to compare other objects such as views, stored procedures, and so on./exclude:table
To specify more than one object or object type for exclusion use multiple /exclude switches. For example, to exclude only tables and views.
sqlcompare /db1:WidgetStaging /db2:WidgetProduction /exclude:table:WidgetReferences /exclude:view |
You can't use /exclude with the /include and /project switches. |
For a more detailed example using the /include and /exclude switches, see Selecting tables with unrelated names.
Alias: /ftr
Specifies a custom filter to select objects for deployment.
sqlcompare /db1:WidgetStaging /db2:WidgetProduction /sync
/filter:MarketingViewsOnly.scpf
You can set up a filter to include or exclude objects based on their type, name, and owner (schema) name.
This is useful, for example, if you want to create complex selection rules without using regular expressions.
|
For more information, see Using filters.
Alias: /f
This forces the overwriting of any output files that already exist. If this switch isn't used and a file of the same name already exists, the program will exit with the exit code indicating an IO error.
Alias: /?
Displays the list of switches in the command line with basic descriptions.
If /help is used with any switches except /verbose, /html, /out, /force or /outputwidth then those extra switches will be ignored; the help message will be printed and the process will end with exit code 0.
Outputs the help text as HTML. Must be used with the /help switch.
If SQL Compare encounters any high level errors when parsing a scripts folder, it will exit with an error code of 62.
Use /ignoreParserErrors to force SQL Compare to continue without exiting.
When you are creating a scripts folder using /makescripts, SQL Compare automatically detects the case sensitivity of the data source.
Use /ignoreSourceCaseSensitivity to disable automatic detection of case sensitivity.
We recommend using filters instead of /include. For more information, see Using filters. |
| only those objects that aren't present in the source (eg /db1) |
| only those objects that aren't present in the target (eg /db2) |
| only those objects that are present in both data sources, but are different. |
| identical objects in the command line output and any generated reports. |
| objects you specify with a regular expression (eg /include:Table:WidgetPurchases) |
| static data in a source-controlled database or a scripts folder |
This switch is used to specify the list of objects to include. You can use an /include switch for each object that you want to compare. However, this can be unwieldy if there is a long list. Instead, you can use the pipe character ( | ) to separate the table names:
sqlcompare /db1:Customers1 /db2:Customers2 /include:table /include:table:\[Product\]^|Customer^|Order^|Invoice |
For more detailed information on using the /include switch, see Selecting tables with unrelated names.
Alias: /log
Creates a log file with a specified minimum log level.
Log files collect information about the application while you are using it. These files are useful to us if you have encountered a problem. For more information, see Logging and log files.
| Disables logging |
| Reports serious and fatal errors |
| Reports warning and error messages |
| Reports all messages in the log file |
The default is None.
sqlcompare /db1:WidgetStaging /makeScripts: D:\Scripts Folder /logLevel:Verbose |
You must use /logLevel each time you want a log file to be created. |
Alias: /mkscr
Creates a scripts folder from the data source.
sqlcompare /db1:WidgetStaging /makeScripts:"C:\Scripts Folders\Widget staging scripts" |
If the folder already exists an error will occur. To merge scripts into an existing scripts folder, compare them with that folder and use the /synchronize switch.
sqlcompare /scr1:"C:\Scripts Folders\Widget dev scripts" /scr2:"C:\Scripts Folders\Widget staging scripts" /synchronize |
For more information, see Working with scripts folders.
Alias: /mksnap
Creates a snapshot from the data source.
sqlcompare /db1:WidgetStaging /makeSnapshot:"C:\Widget Snapshots\StagingSnapshot.snp" |
If the file already exists an error will occur, unless you have also used the /force switch.
Alias: /mf
The path to a directory containing migration scripts you want to use.
Alias: /o
Applies the project configuration options used during comparison or deployment:
sqlcompare /db1:WidgetStaging /db2:WidgetProduction /options:Default,IgnoreWhiteSpace |
For a detailed list of these options see Options used in the command line.
Redirects console output to the specified file.
sqlcompare /db1:WidgetStaging /db2:WidgetProduction /out:C:\output file |
Alias: /outpr
Writes the settings used for the comparison to the specified SQL Compare project file.
sqlcompare /db1:WidgetStaging /db2:WidgetProduction /options:Default,IgnoreWhiteSpace /outputProject:"C:\WidgetProject.scp" |
This also generates a SQL Compare project file. These files end with a .scp extension. If the file already exists an error will occur, unless you have also used the /force switch.
Forces the width of console output.
This can be used to ensure that database object names etc aren't truncated, and that SQL script lines aren't wrapped or broken. This is particularly useful when redirecting output to a file as it allows you to overcome the limitations of the default console width of 80 characters.
Alias: /p1
The password for the source database.
You must also provide a username. If you don't specify a username and password combination, integrated security is used.
sqlcompare /db1:WidgetStaging /userName1:User1 /password1:P@ssw0rd /db2:WidgetProduction /userName2:User2 /password2:Pa$$w0rd |
This switch is only used if the source is a database. If the source is a backup, use /backupPasswords1 |
Alias: /p2
The password for the target database.
Alias: /pr
Uses a SQL Compare project (.scp) file for the comparison.
To use a project you have saved as "widgets.scp" from the command line:
sqlcompare /project:"C:\SQLCompare\Projects\Widgets.scp" |
|
The /project switch is useful, for example, as you can't specify a custom filter in the command line, and specifying complex object selections using a regular expression can be unwieldy.
For more information on using projects, and what a project contains, see Working with projects.
Alias: /q
Quiet mode: no output.
Alias: /r
Generates a report and writes it to the specified file.
The type of report is defined by the /reportType switch. If the file already exists an error will occur, unless you have used the /force switch:
sqlcompare /db1:WidgetStaging /db2:WidgetProduction /report:"C:\reports\WidgetReport.html" /reportType:Simple |
Alias: /rad
Includes all objects with differences in the reports, rather than all selected objects.
Alias: /rt
| Simple XML report |
| Simple HTML report |
| Interactive HTML report |
| Microsoft Excel spreadsheet |
This switch defines the file format of the report produced by the /Report switch. The default is XML.
sqlcompare /db1:WidgetStaging /db2:WidgetProduction /report:"C:\reports\WidgetReport.html" /reportType:Simple |
For more information, see Exporting the comparison results.
Alias: /r1
Specifies the source control revision of the source database. To specify a revision, the database must be linked to SQL Source Control. To specify the latest version, type: HEAD
Specifying a revision other than HEAD is only supported with TFS, SVN and Vault. If you're using another source control system, we recommend checking the revision out to a local folder and using the /Scripts1 switch. |
The following example compares revision 3 of WidgetStaging with the latest revision of WidgetProduction:
sqlcompare /db1:WidgetStaging /revision1:3 /db2:WidgetProduction /revision2:HEAD |
Alias: /r2
Specifies the source control revision of the target database. To specify a revision, the database must be linked to SQL Source Control.
Alias: /sf
Generates a SQL script to migrate the changes which can be executed at a later time. If the file already exists an error will occur, unless you use the /force switch.
sqlcompare /db1:WidgetStaging /db2:WidgetProduction /scriptFile:"C:\Scripts Folder\WidgetSyncScript.sql" |
/Scriptfile can be used when the target ( /db2, /scr2, /sn2 ) is a database, a snapshot, or a scripts folder.
If the target is a snapshot or a scripts folder, the generated script modifies a database with the schema represented by that snapshot or scripts folder.
Alias: /scr1
Specifies the scripts folder to use as the source.
sqlcompare /scripts1:"C:\Scripts Folder\WidgetStagingScript" /db2:WidgetProduction |
Alias: /scr2
Specifies the scripts folder to use as the target.
Alias: /sfx
The path to a text file that describes the location of a source control repository.
To create the text file:
Alias: /s1
Specifies the server on which the source (/db1:) database is located. If an explicit path isn't specified, it defaults to Local.
sqlcompare /server1:Widget_Server\SQL2008 /db1:WidgetStaging /db2:WidgetProduction |
Alias: /s2
Specifies the server on which the target (/db2:) database is located. If an explicit path isn't specified, it defaults to Local.
Alias: /warn
Displays any warnings that apply to the deployment.
sqlcompare /db1:WidgetStaging /db2:WidgetProduction /showWarnings |
For more information about warnings in SQL Compare, see Warnings.
Alias: /sn1
Specifies the snapshot to use as the source.
sqlcompare /snapshot1:"C:\Snapshots\WidgetStagingSnapshot.snp" /db2:WidgetProduction |
Alias: /sn2
Specifies the snapshot to use as the target.
sqlcompare /db1:WidgetStaging /snapshot2:"C:\Snapshots\WidgetProductionSnapshot.snp" |
Allows a folder of scripts to be used as the source.
Allows a folder of scripts to be used as the target.
Aliases: /sync or /synchronise
Synchronizes (deploys) the databases after comparison.
The target (eg /db2) is modified; the source (eg /db1) isn't modified:
sqlcompare /db1:WidgetStaging /db2:WidgetProduction /synchronize |
Alias: /senc
| UTF-8 encoding, without preamble |
| UTF-8 encoding, with 3-byte preamble |
| UTF-16 encoding |
| ASCII encoding |
Used with /scriptFile. Specifies the character encoding used when writing the SQL script file. The default is UTF8.
sqlcompare /db1:WidgetStaging /db2:WidgetProduction /scriptFile:"C:\Scripts Folder\WidgetSyncScript.sql" /syncScriptEncoding:ASCII |
Alias: /ti
Specifies a connection string to a SQL Server instance to be used instead of LocalDB when generating deployment scripts that contain V2 migration scripts.
sqlcompare /db1:WidgetStaging /db2:WidgetProduction /Tempinstance:"Data Source=localhost;Integrated Security=SSPI;" |
For more information about the temporary database, see Setting the location of the temporary database in the SQL Source Control documentation.
Alias: /til
Specifies the Transaction Isolation Level to set in the SQL script.
Alias: /u1
The username for the source database.
If no username is specified, integrated security is used.
sqlcompare /db1:WidgetStaging /userName1:User1 /password1:P@ssw0rd /db2:WidgetProduction /userName2:User2 /password2:Pa$$w0rd |
Alias: /u2
The username for the target database.
If no username is specified, integrated security is used.
Alias: /v
Verbose mode.
Alias: /vu1
Specifies the username for the source control server linked to the source database.
sqlcompare /db1:WidgetStaging /v1:3 /versionUserName1:User1 /vp1:P@ssw0rd /db2:WidgetProduction /v2:HEAD /versionUserName2:User2 /vp2:Pa$$w0rd |
If you have a username saved in SQL Source Control, you don't need to specify it in the command line.
Alias: /vu2
Specifies the username for the source control server linked to the target database.
Alias: /vp1
Specifies the password for the source control server linked to the source database.
sqlcompare /db1:WidgetStaging /v1:3 /vu1:User1 /versionpassword1:P@ssw0rd /db2:WidgetProduction /v2:HEAD /vu2:User2 /versionpassword2:Pa$$w0rd |
If you have a password saved in SQL Source Control, you don't need to specify it in the command line.
Alias: /vp2
Specifies the password for the source control server linked to the target database.
This switch is deprecated. Instead use /include:Identical |
/include:Identical suppresses the exit code if the two data sources are identical.
If /include:Identical isn't set, and the data sources are identical, SQL Compare returns the error code 63.
This switch is deprecated. Instead use /include:Identical. |
This switch is deprecated. Instead use /migrationsfolder. |
Alias: /mfx
The path to a text file that describes the location of a migration scripts folder.
To create the text file: