Export (0) Print
Expand All

Appendix A: SQL Database Scripts

To create the CONTOSO database use the following:


USE [master]
GO

/****** Object:  Database [CONTOSO]    Script Date: 10/05/2011 04:40:17 ******/
CREATE DATABASE [CONTOSO] ON  PRIMARY 
( NAME = N'CONTOSO', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\CONTOSO.mdf' , SIZE = 2048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'CONTOSO_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\CONTOSO_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO

ALTER DATABASE [CONTOSO] SET COMPATIBILITY_LEVEL = 100
GO

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [CONTOSO].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO

ALTER DATABASE [CONTOSO] SET ANSI_NULL_DEFAULT OFF 
GO

ALTER DATABASE [CONTOSO] SET ANSI_NULLS OFF 
GO

ALTER DATABASE [CONTOSO] SET ANSI_PADDING OFF 
GO

ALTER DATABASE [CONTOSO] SET ANSI_WARNINGS OFF 
GO

ALTER DATABASE [CONTOSO] SET ARITHABORT OFF 
GO

ALTER DATABASE [CONTOSO] SET AUTO_CLOSE OFF 
GO

ALTER DATABASE [CONTOSO] SET AUTO_CREATE_STATISTICS ON 
GO

ALTER DATABASE [CONTOSO] SET AUTO_SHRINK OFF 
GO

ALTER DATABASE [CONTOSO] SET AUTO_UPDATE_STATISTICS ON 
GO

ALTER DATABASE [CONTOSO] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO

ALTER DATABASE [CONTOSO] SET CURSOR_DEFAULT  GLOBAL 
GO

ALTER DATABASE [CONTOSO] SET CONCAT_NULL_YIELDS_NULL OFF 
GO

ALTER DATABASE [CONTOSO] SET NUMERIC_ROUNDABORT OFF 
GO

ALTER DATABASE [CONTOSO] SET QUOTED_IDENTIFIER OFF 
GO

ALTER DATABASE [CONTOSO] SET RECURSIVE_TRIGGERS OFF 
GO

ALTER DATABASE [CONTOSO] SET  DISABLE_BROKER 
GO

ALTER DATABASE [CONTOSO] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO

ALTER DATABASE [CONTOSO] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO

ALTER DATABASE [CONTOSO] SET TRUSTWORTHY OFF 
GO

ALTER DATABASE [CONTOSO] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO

ALTER DATABASE [CONTOSO] SET PARAMETERIZATION SIMPLE 
GO

ALTER DATABASE [CONTOSO] SET READ_COMMITTED_SNAPSHOT OFF 
GO

ALTER DATABASE [CONTOSO] SET HONOR_BROKER_PRIORITY OFF 
GO

ALTER DATABASE [CONTOSO] SET  READ_WRITE 
GO

ALTER DATABASE [CONTOSO] SET RECOVERY FULL 
GO

ALTER DATABASE [CONTOSO] SET  MULTI_USER 
GO

ALTER DATABASE [CONTOSO] SET PAGE_VERIFY CHECKSUM  
GO

ALTER DATABASE [CONTOSO] SET DB_CHAINING OFF 
GO

To create the HR table use the following:

USE [CONTOSO]
GO

/****** Object:  Table [dbo].[HR]    Script Date: 10/05/2011 04:41:53 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[HR](
[FirstName] [char](20) NULL,
[LastName] [char](30) NULL,
[EMail] [nchar](30) NULL,
[EmployeeID] [nchar](10) NULL,
[FullName] [char](50) NULL,
[AccountName] [char](20) NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

To populate the HR table use the following:

USE [HR]
GO
INSERT INTO HR (FirstName, LastName, EMail, EmployeeID, FullName, AccountName) 
VALUES ('John', 'Smith', 'jsmith@corp.contoso.com', '11255', 'John Smith', 'jsmith') 
INSERT INTO HR (FirstName, LastName, EMail, EmployeeID, FullName, AccountName) 
VALUES ('Jane', 'Doe', 'jdoe@corp.contoso.com', '11277', 'Jane Doe', 'jdoe') 


Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft