Command-Line Reference for VSDBCMD (Deployment and Schema Import)
You can use VSDBCMD to deploy a database or to import a database schema into a .dbschema file at a command prompt. In addition, you can specify options to customize how your database is deployed or imported. For more information about how you can use this tool, see How to: Prepare a Database for Deployment From a Command Prompt by Using VSDBCMD and How to: Import a Schema From a Command Prompt.
General Options
The options in the following table apply to both the Deploy and Import actions.
Option |
Short Form |
Required? |
Notes |
---|---|---|---|
/Action:{Import|Deploy} |
/a:{Import|Deploy} |
Yes |
Specifies whether you want to import objects and settings into a .dbschema file or whether you want to deploy a .dbschema file to a target server or database. |
/ConnectionString:"String" |
/cs:"String" |
Yes |
Specifies the connection string to the target database. For more information about the syntax of connection strings, see Connection String Syntax (ADO.NET). |
/DatabaseSchemaProvider:DspName |
/dsp:DspName |
Yes |
Specifies the type of database schema provider to which you are connecting. For example, use /dsp:SQL for SQL Server. |
@File |
Not available |
No |
You can specify a response file that contains one or more command-line options. |
/Quiet |
/q |
No |
Specifies whether you want to suppress detailed feedback from VSDBCMD. |
/DeployToDatabase[+|-] |
/dd |
No |
Specifies that you want to generate a deployment script and deploy it to the target database. If you do not specify this option, you generate a deployment script, but that script is not deployed. |
/ModelFile:FileName |
/model:FileName |
Yes |
Specifies the name of the .dbschema file that you want to deploy or that you want to create when you import a schema. |
/Properties:PropertyName=PropertyValue |
/p:PropertyName=PropertyValue |
No |
Specifies a property name and a value that you want to override at a command prompt. See Deployment Options and Import Options for properties that are specific to those actions. |
Deployment Options
The options in the following table apply only when you deploy a .dbschema file.
Option |
Short Form |
Required? |
Notes |
---|---|---|---|
/ManifestFile:FileName |
/manifest:FileName |
Yes |
Specifies the deployment manifest file to use when you deploy the database. The deployment manifest is created in the build output path when you build your database project. ![]()
Deployment will fail if your deployment manifest file references an output script file that already exists and is read-only, even if you specify a different output script name (by using /DeploymentScriptFile:filename).
|
/DeploymentScriptFile:FileName |
/script:FileName |
Yes |
Specifies the name that you want to give to the deployment script. |
Common Deployment Properties
You can specify the properties in the following table when you deploy a .dbschema file from a command prompt.
Option |
Default Value |
Notes |
---|---|---|
/p: SqlCommandVariablesFile=FileName |
The .sqlcmdvars file that is specified in the .deploymanifest file. |
Specifies the .sqlcmdvars file that you want to use when you deploy. |
/p:DeploymentConfigurationFile=fileName |
The .sqldeployment file that is specified in the .deploymanifest file. |
Specifies the .sqldeployment file that you want to use when you deploy. |
/p:PerformDatabaseBackup={True|False} |
True |
Specifies whether you want to back up the database before you deploy changes. |
/p:BlockOnPossibleDataLoss={True|False} |
False |
Specifies whether you want deployment to stop if data loss might occur. |
/p:CollationPreference={UseSourceModelCollation | UseTargetModelCollation | DontChangeCollation} |
UseSourceModelCollation |
Specifies the collation that you want to apply to the target database. |
/p:CommentOutSetVarDeclarations={True|False} |
False |
Specifies whether you want the SETVAR statements that specify values for variables to be commented out in the deployment script. You might set this property to True if you want to use SQLCMD to deploy the script and you want to specify values for those variables at the command prompt. |
/p:AlwaysCreateNewDatabase={True|False} |
False |
Specifies whether the database should be updated or whether it should be dropped and re-created when you deploy changes. |
/p:DeployDatabaseInSingleUserMode={True|False} |
False |
Specifies whether the database should be set to single-user mode before you deploy it. |
/p: GenerateDropsIfNotInProject={True|False} |
False |
Specifies whether you want to drop objects that are in the target database if they do not occur in the database project. |
/p:GenerateDatabaseOptions={True|False} |
True |
Specifies whether the deployment script should contain statements that set the database options when you deploy the database. |
/p:GenerateDeployStateChecks={True|False} |
True |
Specifies whether you want the deployment script to contain statements that verify the state of the target database before you deploy the database schema. |
/p:TargetDatabase="String" |
Not available |
Specifies the name of the database to which you want to deploy. |
Note
Each property must be specified separately. The following example is not valid: VSDBCMD /a:Deploy /dsp:sql /p:TargetDatabase=AccountingQueue;AlwaysCreateNewDatabase=false /cs:"ConnectionString". You must instead use the following command: VSDBCMD /a:Deploy /dsp:sql /p:TargetDatabase=AccountingQueue /p:AlwaysCreateNewDatabase=false /cs:"ConnectionString"
You can display a complete list of deployment by typing the following command at a command prompt:
VSDBCMD /? /a:Deploy /dsp:sql /cs:"ConnectionString"
Common Import Properties
The properties in the following table apply only when you import objects and settings into a .dbschema file.
Option |
Default |
Notes |
---|---|---|
/p:IgnoreExtendedProperties={True|False} |
False |
Specifies whether extended properties should be ignored or imported. |
/p:IgnorePermissions={True|False} |
False |
Specifies whether permissions should be ignored or imported. |
You can display a complete list of import properties by typing the following command at a command prompt:
VSDBCMD /? /a:Import /dsp:sql /cs:"ConnectionString"
See Also
Tasks
How to: Prepare a Database for Deployment From a Command Prompt by Using VSDBCMD
Concepts
Build and Deploy Databases to a Staging or Production Environment
Terminology Overview of Database Edition
Change History
Date |
History |
Reason |
---|---|---|
June 2010 |
Updated command and property names to address feedback on the content Wiki. |
Customer feedback. |