Maybe the same user shouldn't be the God user in all three environments. That's fair. Here is what to do:
- right-click on the project in the Solution Explorer and pick "Properties"
- click on the "SQLCMD Variables" tab
- Add a variable here with a default value. The variable name should be wrapped in parenthesis with a leading dollar sign like so:
$(yournamehere)
The convention of the leading dollar sign leading into a variable in parenthesis will be honored throughout your .sql files in the Visual Studio project even though in the strictest sense that really wouldn't mean anything elsewhere in T-SQL. - How do I use a variable with a setting other than the default? you ask. Great question! Under the "_Publish" folder, right-click on one of the .xml files for the publish settings for a given environment and pick " Open With..." followed by "XML (Text) Editor" to see a swath of XML. You'll customize up the ending like so:
</PropertyGroup>
<ItemGroup>
<SqlCmdVariable Include="yournamehere">
<Value>TomJaeschke</Value>
</SqlCmdVariable>
<SqlCmdVariable Include="environment">
<Value>TEST</Value>
</SqlCmdVariable>
</ItemGroup>
</Project>
No comments:
Post a Comment