How to Deploy a Database to Windows Azure

There are several different ways you can move an on-premises SQL Server database to Windows Azure. In this task, you'll use the Deploy Database to SQL Database wizard to upload a sample database.

The School sample database is conveniently simple; all of its objects are compatible with SQL Database, eliminating the need to modify or prepare a database for migration. As a new administrator, try deploying a simple database first to learn the steps before using your own databases.

Note: Review the SQL Database Migration Guide for detailed instructions on how to prepare an on-premises database for migration to Windows Azure. Also, consider downloading the Windows Azure Training Kit. It includes a lab that shows an alternative approach to migrating an on-premises database.

Table of Contents

How to: Create the school database on an on-premises server

Scripts for creating this database can be found in the Getting Started with SQL Database Administration. In this guide, you'll run these scripts in Management Studio to create an on-premises version of the school database.

  1. In Management Studio, connect to an on-premises server. Right-click Databases, click New Database, and enter school.

  2. Right-click on school, click New Query.

  3. Copy and then execute the Create Schema script from the tutorial.

--Create the Department table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[Department]')
AND type in(N'U'))BEGIN
CREATE TABLE [dbo].[Department]([DepartmentID][int] NOT NULL,[Name][nvarchar](50) NOT NULL,[Budget][money] NOT NULL,[StartDate][datetime] NOT NULL,[Administrator][int] NULL,
CONSTRAINT [PK_Department] PRIMARY KEY CLUSTERED
([DepartmentID] ASC
)WITH (IGNORE_DUP_KEY = OFF))END;
GO --Create the Person table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[Person]')
AND type in(N'U'))BEGIN
CREATE TABLE [dbo].[Person]([PersonID][int] IDENTITY(1,1) NOT NULL,[LastName][nvarchar](50) NOT NULL,[FirstName][nvarchar](50) NOT NULL,[HireDate][datetime] NULL,[EnrollmentDate][datetime] NULL,
CONSTRAINT [PK_School.Student] PRIMARY KEY CLUSTERED
([PersonID] ASC
)WITH (IGNORE_DUP_KEY = OFF))END;
GO --Create the OnsiteCourse table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[OnsiteCourse]')
AND type in(N'U'))BEGIN
CREATE TABLE [dbo].[OnsiteCourse]([CourseID][int] NOT NULL,[Location][nvarchar](50) NOT NULL,[Days][nvarchar](50) NOT NULL,[Time][smalldatetime] NOT NULL,
CONSTRAINT [PK_OnsiteCourse] PRIMARY KEY CLUSTERED
([CourseID] ASC
)WITH (IGNORE_DUP_KEY = OFF))END;
GO --Create the OnlineCourse table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[OnlineCourse]')
AND type in(N'U'))BEGIN
CREATE TABLE [dbo].[OnlineCourse]([CourseID][int] NOT NULL,[URL][nvarchar](100) NOT NULL,
CONSTRAINT [PK_OnlineCourse] PRIMARY KEY CLUSTERED
([CourseID] ASC
)WITH (IGNORE_DUP_KEY = OFF))END;
GO --Create the StudentGrade table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[StudentGrade]')
AND type in(N'U'))BEGIN
CREATE TABLE [dbo].[StudentGrade]([EnrollmentID][int] IDENTITY(1,1) NOT NULL,[CourseID][int] NOT NULL,[StudentID][int] NOT NULL,[Grade][decimal](3,2) NULL,
CONSTRAINT [PK_StudentGrade] PRIMARY KEY CLUSTERED
([EnrollmentID] ASC
)WITH (IGNORE_DUP_KEY = OFF))END;
GO --Create the CourseInstructor table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[CourseInstructor]')
AND type in(N'U'))BEGIN
CREATE TABLE [dbo].[CourseInstructor]([CourseID][int] NOT NULL,[PersonID][int] NOT NULL,
CONSTRAINT [PK_CourseInstructor] PRIMARY KEY CLUSTERED
([CourseID] ASC,[PersonID] ASC
)WITH (IGNORE_DUP_KEY = OFF))END;
GO --Create the Course table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[Course]')
AND type in(N'U'))BEGIN
CREATE TABLE [dbo].[Course]([CourseID][int] NOT NULL,[Title][nvarchar](100) NOT NULL,[Credits][int] NOT NULL,[DepartmentID][int] NOT NULL,
CONSTRAINT [PK_School.Course] PRIMARY KEY CLUSTERED
([CourseID] ASC
)WITH (IGNORE_DUP_KEY = OFF))END;
GO --Create the OfficeAssignment table.
IF NOT EXISTS (SELECT * FROM sys.objects
WHERE object_id = OBJECT_ID(N'[dbo].[OfficeAssignment]')
AND type in(N'U'))BEGIN
CREATE TABLE [dbo].[OfficeAssignment]([InstructorID][int] NOT NULL,[Location][nvarchar](50) NOT NULL,[Timestamp][timestamp] NOT NULL,
CONSTRAINT [PK_OfficeAssignment] PRIMARY KEY CLUSTERED
([InstructorID] ASC
)WITH (IGNORE_DUP_KEY = OFF))END;
GO --Define the relationship between OnsiteCourseandCourse.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_OnsiteCourse_Course]')
AND parent_object_id = OBJECT_ID(N'[dbo].[OnsiteCourse]'))
ALTER TABLE [dbo].[OnsiteCourse] WITH CHECK ADD
CONSTRAINT [FK_OnsiteCourse_Course] FOREIGN KEY([CourseID])
REFERENCES [dbo].[Course]([CourseID]);
GO
ALTER TABLE [dbo].[OnsiteCourse] CHECK
CONSTRAINT [FK_OnsiteCourse_Course];
GO --Define the relationship between OnlineCourseandCourse.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_OnlineCourse_Course]')
AND parent_object_id = OBJECT_ID(N'[dbo].[OnlineCourse]'))
ALTER TABLE [dbo].[OnlineCourse] WITH CHECK ADD
CONSTRAINT [FK_OnlineCourse_Course] FOREIGN KEY([CourseID])
REFERENCES [dbo].[Course]([CourseID]);
GO
ALTER TABLE [dbo].[OnlineCourse] CHECK
CONSTRAINT [FK_OnlineCourse_Course];
GO
--Define the relationship between StudentGradeandCourse.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_StudentGrade_Course]')
AND parent_object_id = OBJECT_ID(N'[dbo].[StudentGrade]'))
ALTER TABLE [dbo].[StudentGrade] WITH CHECK ADD
CONSTRAINT [FK_StudentGrade_Course] FOREIGN KEY([CourseID])
REFERENCES [dbo].[Course]([CourseID]);
GO
ALTER TABLE [dbo].[StudentGrade] CHECK
CONSTRAINT [FK_StudentGrade_Course];
GO --Define the relationship between StudentGradeandStudent.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_StudentGrade_Student]')
AND parent_object_id = OBJECT_ID(N'[dbo].[StudentGrade]'))
ALTER TABLE [dbo].[StudentGrade] WITH CHECK ADD
CONSTRAINT [FK_StudentGrade_Student] FOREIGN KEY([StudentID])
REFERENCES [dbo].[Person]([PersonID]);
GO
ALTER TABLE [dbo].[StudentGrade] CHECK
CONSTRAINT [FK_StudentGrade_Student];
GO --Define the relationship between CourseInstructorandCourse.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_CourseInstructor_Course]')
AND parent_object_id = OBJECT_ID(N'[dbo].[CourseInstructor]'))
ALTER TABLE [dbo].[CourseInstructor] WITH CHECK ADD
CONSTRAINT [FK_CourseInstructor_Course] FOREIGN KEY([CourseID])
REFERENCES [dbo].[Course]([CourseID]);
GO
ALTER TABLE [dbo].[CourseInstructor] CHECK
CONSTRAINT [FK_CourseInstructor_Course];
GO --Define the relationship between CourseInstructorandPerson.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_CourseInstructor_Person]')
AND parent_object_id = OBJECT_ID(N'[dbo].[CourseInstructor]'))
ALTER TABLE [dbo].[CourseInstructor] WITH CHECK ADD
CONSTRAINT [FK_CourseInstructor_Person] FOREIGN KEY([PersonID])
REFERENCES [dbo].[Person]([PersonID]);
GO
ALTER TABLE [dbo].[CourseInstructor] CHECK
CONSTRAINT [FK_CourseInstructor_Person];
GO --Define the relationship between CourseandDepartment.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_Course_Department]')
AND parent_object_id = OBJECT_ID(N'[dbo].[Course]'))
ALTER TABLE [dbo].[Course] WITH CHECK ADD
CONSTRAINT [FK_Course_Department] FOREIGN KEY([DepartmentID])
REFERENCES [dbo].[Department]([DepartmentID]);
GO
ALTER TABLE [dbo].[Course] CHECK CONSTRAINT [FK_Course_Department];
GO --Define the relationship between OfficeAssignmentandPerson.
IF NOT EXISTS (SELECT * FROM sys.foreign_keys
WHERE object_id = OBJECT_ID(N'[dbo].[FK_OfficeAssignment_Person]')
AND parent_object_id = OBJECT_ID(N'[dbo].[OfficeAssignment]'))
ALTER TABLE [dbo].[OfficeAssignment] WITH CHECK ADD
CONSTRAINT [FK_OfficeAssignment_Person] FOREIGN KEY([InstructorID])
REFERENCES [dbo].[Person]([PersonID]);
GO
ALTER TABLE [dbo].[OfficeAssignment] CHECK
CONSTRAINT [FK_OfficeAssignment_Person];
GO

Next, copy and execute the Insert Data script.

--Insert data into the Person table.
SET IDENTITY_INSERT dbo.Person ON;
GO
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (1,'Abercrombie','Kim','1995-03-11',null);
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (2,'Barzdukas','Gytis',null,'2005-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (3,'Justice','Peggy',null,'2001-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (4,'Fakhouri','Fadi','2002-08-06',null);
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (5,'Harui','Roger','1998-07-01',null);
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (6,'Li','Yan',null,'2002-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (7,'Norman','Laura',null,'2003-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (8,'Olivotto','Nino',null,'2005-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (9,'Tang','Wayne',null,'2005-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (10,'Alonso','Meredith',null,'2002-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (11,'Lopez','Sophia',null,'2004-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (12,'Browning','Meredith',null,'2000-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (13,'Anand','Arturo',null,'2003-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (14,'Walker','Alexandra',null,'2000-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (15,'Powell','Carson',null,'2004-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (16,'Jai','Damien',null,'2001-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (17,'Carlson','Robyn',null,'2005-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (18,'Zheng','Roger','2004-02-12',null);
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (19,'Bryant','Carson',null,'2001-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (20,'Suarez','Robyn',null,'2004-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (21,'Holt','Roger',null,'2004-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (22,'Alexander','Carson',null,'2005-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (23,'Morgan','Isaiah',null,'2001-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (24,'Martin','Randall',null,'2005-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (25,'Kapoor','Candace','2001-01-15',null);
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (26,'Rogers','Cody',null,'2002-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (27,'Serrano','Stacy','1999-06-01',null);
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (28,'White','Anthony',null,'2001-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (29,'Griffin','Rachel',null,'2004-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (30,'Shan','Alicia',null,'2003-09-01');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (31,'Stewart','Jasmine','1997-10-12',null);
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (32,'Xu','Kristen','2001-7-23',null);
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (33,'Gao','Erica',null,'2003-01-30');
INSERT INTO dbo.Person(PersonID,LastName,FirstName,HireDate,EnrollmentDate)
VALUES (34,'Van Houten','Roger','2000-12-07',null);
GO
SET IDENTITY_INSERT dbo.Person OFF;
GO
--Insert data into the Department table.
INSERT INTO dbo.Department(DepartmentID,[Name],Budget,StartDate,Administrator)
VALUES (1,'Engineering',350000.00,'2007-09-01',2);
INSERT INTO dbo.Department(DepartmentID,[Name],Budget,StartDate,Administrator)
VALUES (2,'English',120000.00,'2007-09-01',6);
INSERT INTO dbo.Department(DepartmentID,[Name],Budget,StartDate,Administrator)
VALUES (4,'Economics',200000.00,'2007-09-01',4);
INSERT INTO dbo.Department(DepartmentID,[Name],Budget,StartDate,Administrator)
VALUES (7,'Mathematics',250000.00,'2007-09-01',3);
GO
--Insert data into the Course table.
INSERT INTO dbo.Course(CourseID,Title,Credits,DepartmentID)
VALUES (1050,'Chemistry',4,1);
INSERT INTO dbo.Course(CourseID,Title,Credits,DepartmentID)
VALUES (1061,'Physics',4,1);
INSERT INTO dbo.Course(CourseID,Title,Credits,DepartmentID)
VALUES (1045,'Calculus',4,7);
INSERT INTO dbo.Course(CourseID,Title,Credits,DepartmentID)
VALUES (2030,'Poetry',2,2);
INSERT INTO dbo.Course(CourseID,Title,Credits,DepartmentID)
VALUES (2021,'Composition',3,2);
INSERT INTO dbo.Course(CourseID,Title,Credits,DepartmentID)
VALUES (2042,'Literature',4,2);
INSERT INTO dbo.Course(CourseID,Title,Credits,DepartmentID)
VALUES (4022,'Microeconomics',3,4);
INSERT INTO dbo.Course(CourseID,Title,Credits,DepartmentID)
VALUES (4041,'Macroeconomics',3,4);
INSERT INTO dbo.Course(CourseID,Title,Credits,DepartmentID)
VALUES (4061,'Quantitative',2,4);
INSERT INTO dbo.Course(CourseID,Title,Credits,DepartmentID)
VALUES (3141,'Trigonometry',4,7);
GO
--Insert data into the OnlineCourse table.
INSERT INTO dbo.OnlineCourse(CourseID, URL)
VALUES (2030,'http://www.fineartschool.net/Poetry');
INSERT INTO dbo.OnlineCourse(CourseID, URL)
VALUES (2021,'http://www.fineartschool.net/Composition');
INSERT INTO dbo.OnlineCourse(CourseID, URL)
VALUES (4041,'http://www.fineartschool.net/Macroeconomics');
INSERT INTO dbo.OnlineCourse(CourseID, URL)
VALUES (3141,'http://www.fineartschool.net/Trigonometry');--Insert data intoOnsiteCourse table.
INSERT INTO dbo.OnsiteCourse(CourseID,Location,Days,[Time])
VALUES (1050,'123 Smith','MTWH','11:30');
INSERT INTO dbo.OnsiteCourse(CourseID,Location,Days,[Time])
VALUES (1061,'234 Smith','TWHF','13:15');
INSERT INTO dbo.OnsiteCourse(CourseID,Location,Days,[Time])
VALUES (1045,'121 Smith','MWHF','15:30');
INSERT INTO dbo.OnsiteCourse(CourseID,Location,Days,[Time])
VALUES (4061,'22 Williams','TH','11:15');
INSERT INTO dbo.OnsiteCourse(CourseID,Location,Days,[Time])
VALUES (2042,'225 Adams','MTWH','11:00');
INSERT INTO dbo.OnsiteCourse(CourseID,Location,Days,[Time])
VALUES (4022,'23 Williams','MWF','9:00');--Insert data into the CourseInstructor table.
INSERT INTO dbo.CourseInstructor(CourseID,PersonID)
VALUES (1050,1);
INSERT INTO dbo.CourseInstructor(CourseID,PersonID)
VALUES (1061,31);
INSERT INTO dbo.CourseInstructor(CourseID,PersonID)
VALUES (1045,5);
INSERT INTO dbo.CourseInstructor(CourseID,PersonID)
VALUES (2030,4);
INSERT INTO dbo.CourseInstructor(CourseID,PersonID)
VALUES (2021,27);
INSERT INTO dbo.CourseInstructor(CourseID,PersonID)
VALUES (2042,25);
INSERT INTO dbo.CourseInstructor(CourseID,PersonID)
VALUES (4022,18);
INSERT INTO dbo.CourseInstructor(CourseID,PersonID)
VALUES (4041,32);
INSERT INTO dbo.CourseInstructor(CourseID,PersonID)
VALUES (4061,34);
GO
--Insert data into the OfficeAssignment table.
INSERT INTO dbo.OfficeAssignment(InstructorID,Location)
VALUES (1,'17 Smith');
INSERT INTO dbo.OfficeAssignment(InstructorID,Location)
VALUES (4,'29 Adams');
INSERT INTO dbo.OfficeAssignment(InstructorID,Location)
VALUES (5,'37 Williams');
INSERT INTO dbo.OfficeAssignment(InstructorID,Location)
VALUES (18,'143 Smith');
INSERT INTO dbo.OfficeAssignment(InstructorID,Location)
VALUES (25,'57 Adams');
INSERT INTO dbo.OfficeAssignment(InstructorID,Location)
VALUES (27,'271 Williams');
INSERT INTO dbo.OfficeAssignment(InstructorID,Location)
VALUES (31,'131 Smith');
INSERT INTO dbo.OfficeAssignment(InstructorID,Location)
VALUES (32,'203 Williams');
INSERT INTO dbo.OfficeAssignment(InstructorID,Location)
VALUES (34,'213 Smith');--Insert data into the StudentGrade table.
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (2021,2,4);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (2030,2,3.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (2021,3,3);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (2030,3,4);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (2021,6,2.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (2042,6,3.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (2021,7,3.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (2042,7,4);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (2021,8,3);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (2042,8,3);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4041,9,3.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4041,10,null);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4041,11,2.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4041,12,null);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4061,12,null);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4022,14,3);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4022,13,4);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4061,13,4);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4041,14,3);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4022,15,2.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4022,16,2);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4022,17,null);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4022,19,3.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4061,20,4);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4061,21,2);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4022,22,3);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4041,22,3.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4061,22,2.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (4022,23,3);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (1045,23,1.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (1061,24,4);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (1061,25,3);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (1050,26,3.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (1061,26,3);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (1061,27,3);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (1045,28,2.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (1050,28,3.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (1061,29,4);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (1050,30,3.5);
INSERT INTO dbo.StudentGrade(CourseID,StudentID,Grade)
VALUES (1061,30,4);
GO

You now have an on-premises database that you can export to Windows Azure. Next, you'll run a wizard that creates a .bacpac file, loads it onto Windows Azure, and imports it into SQL Database.

How to: Deploy to SQL Database

  1. In Management Studio, connect to an on-premises SQL Server instance that has a database you want to migrate.

  2. Right-click the school database that you just created, point to Tasks, and click Deploy Database to SQL Azure.

  3. In Deployment Settings, enter a name for the database, such as school.

  4. Click Connect.

  5. In Server name, enter the 10-character server name, followed by .database.windows.net.

  6. In Authentication, choose SQL Server Authentication.

  7. Enter the administrator login name and password that you provisioned when creating the SQL Database logical server.

  8. Click Options.

  9. In Connection Properties, in Connect to database, type master.

  10. Click Connect. This step concludes the connection specification and takes you back to the wizard.

  11. Click Next and click Finish to run the wizard.

How to: Verify database deployment

  1. In Management Studio, in Object Explorer refresh the databases to view the new one you just created.

  2. Expand the Databases folder. You should see the school database in the list.

  3. Right-click on the school database and click New Query.

  4. Execute the following query to verify that data is accessible.

SELECT
Course.Titleas"Course Title",Department.Nameas"Department",Person.LastNameas"Instructor",OnsiteCourse.Locationas"Location",OnsiteCourse.Daysas"Days",OnsiteCourse.Timeas"Time"
FROM
Course
INNER JOIN Department
ON Course.DepartmentID=Department.DepartmentID
INNER JOIN CourseInstructor
ON Course.CourseID=CourseInstructor.CourseID
INNER JOIN Person
ON CourseInstructor.PersonID=Person.PersonID
INNER JOIN OnsiteCourse
ON OnsiteCourse.CourseID=CourseInstructor.CourseID;

[Windows Azure] How to Deploy a Database to Windows Azure的更多相关文章

  1. 无责任Windows Azure SDK .NET开发入门篇一[Windows Azure开发前准备工作]

    一.Windows Azure开发前准备工作 首先我们需要了解什么是 Azure SDK for .NET?微软官方告诉我们:Azure SDK for .NET 是一套应用程序,其中包括 Visua ...

  2. Create an Azure SQL database in the Azure portal

    Create a SQL database An Azure SQL database is created with a defined set of compute and storage res ...

  3. Windows Azure Storage (21) 使用AzCopy工具,加快Azure Storage传输速度

    <Windows Azure Platform 系列文章目录> Update 2016-09-28 想要在Azure云端,使用AzCopy工具,从Azure China 上海数据中心存储账 ...

  4. Windows Azure 实操 —— 迁移本地SharePoint服务器到Azure

    博客地址 http://blog.csdn.net/foxdave 注意:如果你是第二代虚拟机,那就别看这个了,老老实实在Azure上重新创建吧,Azure不支持第二代虚拟机. 写在之前,对Azure ...

  5. 在 Windows Azure 网站 (WAWS) 上对 Orchard CMS 使用 Azure 缓存

    编辑人员注释: 本文章由 Windows Azure 网站团队的项目经理 Sunitha Muthukrishna 撰写. 如果您当前的 OrchardCMS 网站在 Windows Azure 网站 ...

  6. Windows Azure 安全最佳实践 - 第 6 部分:Azure 服务如何扩展应用程序安全性

    多种Windows Azure服务可以帮助您将应用程序安全性扩展到云. 有三种服务可提供多个提供程序之间的身份标识映射.内部部署数据中心间的连接和相互发送消息的应用程序功能(无论应用程序位于何处). ...

  7. Windows Azure 安全最佳实践 - 第 2 部分:Azure 提供哪些现成可用的安全机制

    在WindowsAzure安全最佳实践 - 部分:深度解析挑战防御对策中,我介绍了威胁形势以及在您的应用程序中采用深度防御的计划. 在本部分中,我将说明 Windows Azure的安全是一项共同责任 ...

  8. 全网最详细的Windows系统里Oracle 11g R2 Database(64bit)安装后的初步使用(图文详解)

    不多说,直接上干货! 前期博客 全网最详细的Windows系统里Oracle 11g R2 Database(64bit)的下载与安装(图文详解) 命令行方式测试安装是否成功 1)   打开服务(cm ...

  9. 全网最详细的Windows系统里Oracle 11g R2 Database(64bit)的完全卸载(图文详解)

    不多说,直接上干货! 前期博客 全网最详细的Windows系统里Oracle 11g R2 Database(64bit)的下载与安装(图文详解) 若你不想用了,则可安全卸载. 完全卸载Oracle ...

随机推荐

  1. Ubuntu18.04中配置QT5.11开发环境

    准备工作 参考 https://wiki.qt.io/Install_Qt_5_on_Ubuntu . # 安装g++ sudo apt install build-essential # sudo ...

  2. HOOK 底层键盘消息---WH_KEYBOARD_LL

    代码:屏蔽三个全局快捷键 代码的作用是屏蔽掉凝视中的三个快捷键. LRESULT CALLBACK LowLevelKeyboardProc (INT nCode, WPARAM wParam, LP ...

  3. Android中创建倒影效果的工具类

                     一.有时候我们需要创建倒影的效果,我们接触最多的都是图片能够创建倒影,而布局依然可以创建倒影.       二.工具类代码 import android.graphi ...

  4. iOS Main Thread Checker: UI API called on a background thread的解释

    Xcode打印栏出现如下警告: Main Thread Checker: UI API called on a background thread 这个是什么错误呢? 其实这并不一定是错误,也可以理解 ...

  5. 【AI】Computing Machinery and Intelligence - 计算机器与智能

    [论文标题] Computing Machinery and Intelligence (1950) [论文作者] A. M. Turing (Alan Mathison Turing) [论文链接] ...

  6. Linux-非结构化数据同步-Linux下Rsync+Rsync实现非结构化增量差异数据的同步2

    说明: 操作系统:CentOS 5.X 源服务器:192.168.21.129 目标服务器:192.168.21.127,192.168.21.128 目的:把源服务器上/home/www.osyun ...

  7. IP概念盛行的背后:资本在狂欢,电影想哭泣 IP,英文“Intellectual Property”的缩写,直译为“知识产权”。它的存在方式很多元,可以是一个故事,也可以是某一个形象,运营成功的IP可以在漫画、小说、电影、玩具、手游等不同的媒介形式中转换。

    IP概念盛行的背后:资本在狂欢,电影想哭泣 IP容易拉投资.谈合作,甚至还能简化宣发途径,越来越多的人涌入了电影这个产业,争抢IP成为他们进入行业的最快捷的方法.IP盛行暴露出的另一个问题是国产电影原 ...

  8. nRF2401A/nRF24L01/nRF24L01+无线模块最常见问题汇集(转)

    俗话说:每个人一生下来什么都会的,都是通过自己努力和探索出来的,NRF系列芯片,刚开始都好奇心加兴趣才来捣鼓它的,刚开始做硬件和软件,没有收发数据弄得整个人头都快炸开了,所以在此和大家分享一下前辈的经 ...

  9. 解决Android中多次点击(快速点击多次 )启动多个相同界面的问题

    通过以下代码可以解决这个问题. /** * 防止快速点击 * @param ev * @return */ @Override public boolean dispatchTouchEvent(Mo ...

  10. 传智播客c/c++公开课学习笔记--邮箱账户的破解与邮箱安全防控

    一.SMTP协议 SMTP(SimpleMail Transfer Protocol)即简单邮件传输协议. SMTP协议属于TCP/IP协议簇,通过SMTP协议所指定的server,就能够把E-mai ...