- Creating a Database Project
- Database References
- Scripts
- Create Scripts
- Change Scripts
- Running the Scripts
- Command Files
- Queries
- Summary
Database References
A database reference is a pointer to a database. However, this reference doesn't allow you to access and view the database objectsthat's the job of the database connection.
A database reference is stored as part of the database project that is saved to disk. Whenever the project is opened, the project scans the list of database connections currently defined in the Server Explorer to see if a connection to the referenced database already exists. If such a connection doesn't exist, the database project automatically creates one.
The first database reference added to a project becomes the default reference for the project. That is, unless specified otherwise, the scripts and queries that will be designed and/or run will be against that database reference.
NOTE
The icon for a database reference is a shortcut icon on top of a database icon. For the default database reference, the shortcut icon is red, green, and white. For the other references, the shortcut icon is black and white.
TIP
You can change the default reference for the project by right-clicking on the reference that you would like to be the default and selecting Set as Project Default from the context menu displayed.
You can add database references by right-clicking on the Database References node and selecting New Database Reference from the context menu displayed.
NOTE
You can add another database reference and make it the default all at once. Right-click on the database project name (main node) in the Solution Explorer and then select the Set Default Reference menu item from the displayed context menu. Doing so displays the Set Default Reference dialog box. If you choose a database connection from the list of connections, it is added to the project and set to be the default database reference.