Search code examples
argumentssql-server-data-toolssqlpackage

Error when calling SQLPackage 'publish' with TargetDatabaseName or tdn argument


As the SQLPackage manual here when calling publish action, we have the argument TargetDatabaseName or tdn (in section Target Parameters)

But when adding this parameter to SQLPackage call, I got the error saying that the argument is not valid.

Example:

SQLPackage.exe 
  /a:Publish 
  /SourceFile:"Path\to\My\CompiledDbProjectFile.dacpac"       
  /TargetUser:"SomeLoginName"  
  /TargetPassword:"SomePassword" 
  /TargetServerName:"SomeSQLServerInstance" 
  /TargetDatabaseName="SomeDatabase" 
  /p:BlockOnPossibleDataLoss=true 
  /p:DropRoleMembersNotInSource=false 
  /p:DropPermissionsNotInSource=false 
  /p:DropObjectsNotInSource=false

Is that a bug? How can we work around for that?

Currently I have to use the /tcs:"The connections tring goes here"


Solution

  • This syntax is wrong

    /TargetDatabaseName="SomeDatabase"
    

    The correct one should be

    /TargetDatabaseName:"SomeDatabase"
    

    Cheers