Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

question from:https://stackoverflow.com/questions/65833898/sql-server-sqlpackage-variables-are-quotes-needed-around-string-variable

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.6k views
Welcome To Ask or Share your Answers For Others

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...