Home > Articles > Programming > Windows Programming

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

Running the Scripts

You can run a script directly within the Solution Explorer. The easiest way to do so is to drag the script that you want to run and drop it on the database reference that you want to run it against. Alternatively, you can right-click on the script that you want to run. The context menu displayed has both a Run and a Run On menu items. Selecting the Run item executes the script against the default database reference. Selecting the Run On menu item, as shown in Figure 8.9, allows you to specify a database other than the current default. Note that you can choose from existing database references or use this opportunity to add a new one.

Figure 9Figure 8.9 The Run On dialog box


NOTE

You can also choose to define a temporary database reference to run this script on. Double-clicking on the last item in the list, <temporary reference>, displays the familiar Data Link Properties dialog for you to use to define the connection. However, this reference won't be added to the project or to the Server

To apply the changes that you previously designed and saved in the script tblEmployee.sql, do the following.

  1. Verify that the tblEmployee table does not contain the StartDate field. In the Server Explorer, expand the node for tblEmployee to list the fields of the table, as shown in Figure 8.10.

    Figure 10Figure 8.10 Displaying the fields of tblEmployee


  2. Expand the Change Scripts folder in the Solution Explorer and select the tblEmployee.sql script.

  3. Drag and drop the script onto the reference for the Novelty database in the Solution Explorer.

  4. The Execute Scripts or Queries dialog box is shown, giving you a chance to confirm that you want to run the script on the specified database. Click on the Yes button to continue and to run the script.

  5. Repeat step 1 to again display the fields of the table (or just click on the Refresh button on Server Explorer toolbar if it remained open). The newly added StartDate field now appears.

  • + Share This
  • 🔖 Save To Your Account