Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
This chapter is from the book

Scripts

The database project template automatically creates two folders for holding SQL scripts. The Create Scripts folder is meant to hold scripts that are used to re-create the database from scratch, or to re-create a portion of the database that has undergone changes.

The Change Scripts folder is meant to contain SQL scripts that reflect desired changes that you haven't yet made to the database. Changes may be "placed on hold" because, as a developer, you don't have sufficient security privileges to modify a production database (sometimes not a bad idea!) or because changes from multiple sources are to be combined and applied all at once as a unit.

NOTE

The folder names given are by convention only. You can change them to something different that you prefer or find more meaningful. Of course, being able to change them also means that you have the flexibility to mess things up, or at least confuse others (or even yourself) who need to use your project.

TIP

You can also add other folders to a database project. For example, you may want a separate folder to store scripts required for upgrading the database to a specific release version or for other maintenance activities. You may want to have several different query folders, each containing different types of queries. You can add a new folder to the project by right-clicking on the project and selecting the New Folder menu item from the context menu that is displayed.

You can create any SQL script manually, by right-clicking on a folder (or the project) node in the Solution Explorer and then selecting the Add New Item or the Add SQL Script menu item from the displayed context menu. After selecting one of the standard script templates, shown in Figure 8.2, you can edit it manually in the Visual Studio editor.

Figure 2Figure 8.2 The standard script templates displayed in the Add New Item dialog box


What is special about the Create and Change scripts is that you can have them generated automatically.

  • + Share This
  • 🔖 Save To Your Account