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 />

34<br />

Figure 2-9<br />

Note that IntelliSense is new with <strong>SQL</strong> <strong>Server</strong> <strong>2008</strong>. While they have done a terrific job with it, it is not<br />

without some peculiarities created by the nature of <strong>SQL</strong> versus other languages. Of particular importance<br />

is what help you can get when you’re adding columns to be selected. We’ll see more about the syntax of<br />

this in later chapters, but <strong>SQL</strong> syntax calls for column names before the names of the tables those columns<br />

are sourced from. The result is problematic for IntelliSense as, when you are typing your column names,<br />

the tool has no way of knowing what tables you’re trying to get those columns from (and therefore no<br />

way of giving you appropriate hints). If you’re desperate, you can get around this by skipping ahead to<br />

add the table names, then coming back to fill in the column names.<br />

The check-mark icon (Parse) on the <strong>SQL</strong> Editor toolbar represents another simple debugging item that<br />

quickly parses the query for you without actually attempting to run the statement. If there are any syntax<br />

errors, this should catch them before you see error messages. A debugger is available as another way to<br />

find errors. We’ll look at that in depth in Chapter 12.<br />

Now click the Execute button (with the red exclamation point next to it) on the toolbar. The Query window<br />

changes a bit, as shown in Figure 2-10.<br />

Notice that the main window has been automatically divided into two panes. The top is your original<br />

query text; the bottom is called the results pane. In addition, notice that the results pane has a tab at the<br />

top of it. Later on, after we’ve run queries that return multiple sets of data, you’ll see that we can get<br />

each of these results on separate tabs; this can be rather handy, because you often don’t know how long<br />

each set of data, or result set, is.<br />

The terms result set and recordset are frequently used to refer to a set of data that is<br />

returned as a result of some command being run. You can think of these words as<br />

interchangeable.<br />

Now change a setting or two and see how what we get varies. Take a look at the toolbar above the Query<br />

window and check out a set of three icons, highlighted in Figure 2-11.<br />

These control the way you receive output. In order, they are Results to Text, Results to Grid, and Results<br />

to File. The same choices can also be made from the Query menu under the Results To submenu.

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

Saved successfully!

Ooh no, something went wrong!