Skip to main content

Use Database References

SSDT (SQL Server Data Tools) database projects will be able to use database variables, which allows for more dynamic cross-database interactions. This facilitates modularity and eliminates the need to hardcode database names.

When enabled, cross-database names in the generated scripts (such as the stored procedure load logic) are replaced with SqlCmd database variables in the form $(DatabaseName), and the generated projects carry the corresponding database references and SqlCmd variable definitions. The generated deployment scripts pass the variable values through to sqlpackage, so the same projects deploy against differently named databases.

When to Change This Setting

Keep the default N when database names are fixed across environments and plain three-part names are acceptable. Enable it when the solution spans multiple databases whose names differ between environments, so the SSDT projects build and deploy without hard-coded database names.

SettingInteraction
Additional Database ReferencesExtra databases to include as references in the generated projects
Solution NameThe generated solution that ties the referenced database projects together

Notes

  • This setting is part of the SSDT settings category.
  • The default value for this setting is N.