SQL Server 2005 Introduction to SQL Server Management Studio - Exercise 4: Creating a New Database (Page 5 of 6 ) Scenario In this exercise, you will create a new database using a SQL Server Management Studio template. You will then investigate the default properties of a new database. TASKS DETAILED STEPS - Create a new database using a TSQL Template.
- Choose File | New | File.
- In the New File dialog box, in the Categories list, within the SQL Server Query node, select Database. In the Templates list, click create database, and then click Open. If prompted, connect to the database.
A new query window will open, and you should see the following template:
-- ========================================== -- Create database template -- ========================================= IF EXISTS ( SELECT * FROM sys.databases WHERE name = N'<database_name, sysname, sample_database>' ) DROP DATABASE <database_name, sysname, sample_database> GO
CREATE DATABASE <database_name, sysname, sample_database> GO
- Select the Edit | Find and Replace | Quick Replace menu command.
- In the Find what textbox, enter <database_name, sysname, sample_database> (including the angle brackets).
- In the Replace with textbox, enter NewDB.
- Click Replace All. A dialog box should show 3 occurrence(s) replaced. Click OK, and then close the dialog box.
- Press F5 or click the Execute button on the toolbar. Click Connect if necessary.
- Explore your new database.
- In the Object Browser, expand Databases if necessary.
- Right-click on Databases and click Refresh. A NewDB folder should appear.
- Right-click on the NewDB folder and click Properties.
- Explore the properties dialog box to see what properties exist for a newly created database.
Because the Properties window is not modal, you can open a separate Properties window for each database, making it easier to compare the two.
- Close the Properties window(s) when you’re done.
Next: Exercise 5: Setting up Database Access >>
More MS SQL Server Articles More By MSDN Virtual Labs |