O'Reilly logo

Programming Microsoft® SQL Server® 2012 by Leonard Lobel and Andrew Brust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Preparing the Sample Database

Start by creating a basic order entry database in SQL Server. Then you’ll build application code over the database that queries and updates using each of the available data access APIs. Use either SQL Server Data Tools (SSDT) in Visual Studio (covered in Chapter 1) or SQL Server Management Studio (SSMS) to execute the script shown in Example 10-1 and create the sample database.

Example 10-1. T-SQL script for creating the SampleDb database.

USE master GO IF EXISTS(SELECT name FROM sys.databases WHERE name = 'SampleDb') DROP DATABASE SampleDb GO CREATE DATABASE SampleDb GO USE SampleDb GO CREATE TABLE Customer( CustomerId bigint IDENTITY(1,1) NOT NULL, FirstName varchar(50) NOT NULL, LastName varchar(50) NOT NULL, Balance ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required