I have a SQL Server database project (VS2017) and in project properties, the SQLCMD Variables tab looks like this:
Question: I can create a SQLCMD variable and set a Default Value and a Local Value for it. What is the difference?
Note: I do currently use SQLCMD variables in my project, so I think I know how they work, but I can't get my head round this distinction. According to what documentation I can find (highlighting is mine):
In SQL Server Database Projects you can utilize SQLCMD variables to provide dynamic substitution to be used for debugging or publishing. You enter the variable name and values and during build, the values will be substituted. If there are no local values, the default value will be used. By entering these variables in project properties, they will automatically be offered in publishing and are stored in publishing profiles. You can pull in the project values of the variables into publish via the Load Values button.
So it seems that:
- If you only have a Default value, that will be used
- If you only have a Local value, that will be used
- If you have both, the Local value will always be used.
How does this help me? There seems to be no point in having both values set, so why do we need two different values?