Microsoft® SQL Server™ 2008 All-In-One Desk Reference For Dummies®
by Robert D. Schneider, Darril Gibson
II.1.7. Scripting Your Database
When your database is set up and configured just the way you like, SQL Server offers a handy feature — scripting — that lets you re-create and then configure the database much more quickly in the future. Here's how you can take advantage of scripting:
Launch the SQL Server Management Studio.
Connect to the appropriate SQL Server instance.
Expand the connection's entry in the Object Explorer view.
Expand the Databases folder.
Right-click the database you want to script and choose Script Database As
CREATE To
New Query Editor Window.You can also select to save the results to a file or the Clipboard. For this example, we show you the script in a query window, which you can see in Figure 1-8. In reality, you probably want to save the script to a file.
You can use the script any time you want to rebuild your database. This is especially helpful when you're experimenting with new databases.
What's especially nice about scripting is that you can use it for all sorts of administrative tasks, not just creating new databases.
|
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
