Welcome to OverStack Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

azure devops - SQL Server SqlPackage variables: are quotes needed around string variable?

When running sqlpackage.exe for deployments, do string variables require quotes around the word? It seems to be running successfully both ways. What is the correct syntax?

Two options shown here:

/v:CompanyName=ABCD

/v:CompanyName="ABCD"

Resource: https://docs.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage?view=sql-server-ver15


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

@Jeroen Mostert is right. It's more related to the command line not only the SqlPackage.

If the string variable contains spaces equality signs, slashes, or anything else that would interfere with option syntax, the value must be surrounded in "quotes".

Here is the example blog: https://www.addictivetips.com/windows-tips/enter-file-or-folder-paths-with-spaces-in-command-prompt-on-windows-10/

If all of the following conditions are met, then quote characters on the command line are preserved:

  • No /S switch (Strip quotes)
  • Exactly two quote characters
  • No special characters between the two quote characters, where special is one of: & < >( ) @ ^ |
  • There are one or more whitespace characters between the the two quote characters
  • The string between the two quote characters is the name of an executable file.

Ref: https://ss64.com/nt/syntax-cmd.html

HTH.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OverStack Developer Community-Open, Learning and Share
...