13

I am using SqlPackage.exe for my deployment. I have read the documentation here for the usage of SqlPackage.exe.

The documentation only states the synax for one variable:

Specifies a name value pair for an action specific variable; {VariableName}={Value}. The DACPAC file contains the list of valid SQLCMD variables. An error will result if a value is not provided for every variable.

My problem is that the documentation does not say how to pass multiple arguments into the Variables parameter. For example, I want to do this:

sqlpackage.exe ...args go here...  /Variables:VarToOverride=Value1,Var2ToOverride=Value2

Does anyone know the syntax for this?

Aaron Hudon
  • 5,280
  • 4
  • 53
  • 60
gregpakes
  • 4,465
  • 29
  • 43

3 Answers3

28

I have managed to find something that works.

sqlpackage.exe ...args go here... /Variables:VarToOverride=Value1 /Variables:Var2ToOverride=Value2

It's not exactly what I was looking for, but it works.

gregpakes
  • 4,465
  • 29
  • 43
  • 2
    Does anyone else feel it is odd that a flat to be used for a single variable is written in the plural? `/Variable:Foo=Bar` would have made more sense. – Oren Hizkiya Jun 14 '18 at 20:19
  • 3
    This worked for me, and `/v:var1=val1 /v:var2=val2 /v:var3=val3` also works `/v: is a shortcut for /variables:` – reckface Nov 12 '18 at 09:47
2

Did you try separating using semi-colons rather than commas. i.e.:

sqlpackage.exe ...args go here...  /Variables:VarToOverride=Value1;Var2ToOverride=Value2

Your other option is to use Publish Profile files.

jamiet
  • 10,501
  • 14
  • 80
  • 159
1

You can specify the multiple arguments as below. /p:CreateNewDatabase=True /p:Storage=File /p:DatabaseEdition=Standard /p:DatabaseServiceObjective=S3 /p:DatabaseMaximumSize=50 Giving space after each argument.

Amol R
  • 87
  • 8