Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.9k 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

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

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

1 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...