17.06.2013 Views

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

Beginning Microsoft SQL Server 2008 ... - S3 Tech Training

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 2: Tools of the Trade<br />

Note that you have to actually click the Execution Plan tab for it to come up and that your query results<br />

are still displayed in the way you selected. The Show Estimated Execution plan option gives you the<br />

same output as an Include Actual Execution Plan does with two exceptions:<br />

❑ You get the plan immediately rather than after your query executes.<br />

❑ Although what you see is the actual plan for the query, all the cost information is estimated and<br />

the query is not actually run. Under Include Actual Execution, the query is physically executed<br />

and the cost information you get is actual rather than estimated.<br />

Note that the plan in Figure 2-13 is an extremely simple execution plan. More complex queries may<br />

show a variety of branching and parallel operations.<br />

The Available Databases Combo Box<br />

Finally, take another look at the Available Databases combo box. In short, this is where you select the<br />

default database that you want your queries to run against for the current window (we changed AdventureWorks<strong>2008</strong><br />

to be our default database earlier). Initially, the Query window will start with whatever<br />

the default database is for the user that’s logged in (for sa, that is the master database unless someone<br />

has changed it on your system). You can then change it to any other database that the current login has<br />

permission to access. Since we’re using the sa user ID, every database on the current server should have<br />

an entry in the Available Databases combo box.<br />

The Object Explorer<br />

38<br />

This useful little tool enables you to navigate your database, look up object names, and even perform<br />

actions like scripting and looking at the underlying data.<br />

In the example in Figure 2-14, I’ve expanded the database node all the way down to the listing of tables in<br />

the AdventureWorks<strong>2008</strong> database. You can drill down even farther to see individual columns (including<br />

data type and similar properties) of the tables — a very handy tool for browsing your database.<br />

Figure 2-14

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!