Share via


Lesson 1: Creating a Source Database

In this lesson, you will create the sample database used in the following lessons.

Procedures

Create a sample database

  1. In the Object Explorer tab, select the node for the instance of the Database Engine where you want the database to be created, then select the New Query button in the toolbar.

  2. Copy and paste the following code into the Query Editor window. Then, run it to create the sample database on the instance.

    USE master;
    GO
    CREATE DATABASE SampleDB;
    GO
    USE SampleDB;
    GO
    CREATE TABLE dbo.SampleTable
      (PriKey INT PRIMARY KEY,
       CharCol NVARCHAR(20)
      );
    GO
    CREATE VIEW dbo.SampleView
    AS
    SELECT PriKey, CharCol
    FROM dbo.SampleTable;
    GO
    CREATE PROCEDURE dbo.SampleSP
    AS
    SELECT PriKey, CharCol
    FROM dbo.SampleView;
    GO
    
  3. Right-click the node for the instance and select Refresh. The SampleDB should now appear under the Databases node.

Next Steps

You have successfully created a simple database. Next, you will extract a DAC from the sample database. See Lesson 2: Extracting a Data-Tier Application.