Visual Studio Team System
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: Import a Schema From a Command Prompt 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.

/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.

/Verbose

/v

No

Specifies whether you want 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.

NoteNote:
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:SqlCmdVariablesFile=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:BackupDatabaseBeforeChanges:{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:DropObjectsNotInSource:{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.

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.

/p:ModelType:{Database|Server}

Database

Specifies whether you want to import the objects and settings for a database or a server.

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

Concepts

Tags :


Community Content

SNMSDN
/Verbose does not work
It appears as though /Verbose or /v does not actually work and using either just reports an invalid usage.

It was replaced by /Quiet, the default is now to report verbose output and you have to use the /Quiet switch to turn off the verbose output.
Tags : contentbug

Thomas Lee
Properties switch

The properties switch uses an equal sign rather than a colon.

/p:TargetDatabase=myDatabaseName
Tags : contentbug

kunwu
SqlCmdVariablesFile

The property name SqlCmdVariablesFile should be SqlCommandVariablesFile.

/p:SqlCommandVariablesFile=FileName
Tags :

Carlos.V
DropObjectsNotInSource property name
This property has been renamed as:

GenerateDropsIfNotInProject
Tags :

Mike Fourie
Declaring Parameters using /p

Take note that you need to specify each parameter as a separate /p

i.e. you can't do this: /p:TargetDatabase=AccountingQueue;AlwaysCreateNewDatabase=false

you need to do this /p:TargetDatabase=AccountingQueue /p:AlwaysCreateNewDatabase=false

Mike

Tags :

Page view tracker