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.

the pop-up menu, choose Script Database As ➪ CREATE To ➪ New Query Editor Window, as shown in<br />

Figure 5-10.<br />

Figure 5-10<br />

Whoa! <strong>SQL</strong> <strong>Server</strong> generates a heck of a lot more code than we saw when we created our database to<br />

begin with. Don’t panic, however — all it is doing is being very explicit in scripting major database<br />

settings rather than relying on defaults as we did when we scripted it ourselves.<br />

Note that we are not limited to scripting the database — if you want to script other objects in the database,<br />

just navigate and right-click on them much the way that you right-clicked on the Accounting database and,<br />

boom!, you’ve got yourself a <strong>SQL</strong> Script.<br />

As you can see, scripting couldn’t be much easier. Once you get a complex database put together, it still<br />

isn’t quite as easy as it seems in this particular demonstration, but it is a lot easier than writing it all out<br />

by hand. The reality is that it really is pretty simple once you learn what the scripting options are, and<br />

we’ll learn much more about those later in the book.<br />

Summary<br />

Chapter 5: Creating and Altering Tables<br />

In this chapter, we’ve covered the basics of the CREATE, ALTER, and DROP statements as they relate to<br />

creating a database and tables. There are, of course, many other renditions of these that we will cover as<br />

we continue through the book. We have also taken a look at the wide variety of options that we can use<br />

in databases and tables to have full control over our data. Finally, we have begun to see the many things<br />

that we can use the Management Studio for in order to simplify our lives, and make design and scripting<br />

simpler.<br />

151

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

Saved successfully!

Ooh no, something went wrong!