Introduction to Migrating a Database to SQL Server in ASP.Net Web Pages 2

Introduction

Today we'll learn how to migrate a database to SQL Server. You can see in Working with Database in ASP.NET Web Pages 2 using WebMatrix how to create and work with the database.

In that context, the database that was created in the site exists with the name Cricketers.sdf but now when we migrate the database to the SQL Server, it'll change. We'll work here with the Microsoft SQL Server Compact 4.0 version of database. You'll learn here to use the migrate feature and installation of the database.

So, let's proceed with the following sections:

  •  Overview of SQL Server
  • Migrating Database

Overview of SQL Server

There are many benefits you can obtain if you migrate the database to the SQL Server like Stored Procedures and its capabilities, handling more than 256 concurrent databases and so on. You can convert the database to SQL Server Express or SQL Server.

Migrating Database

Step 1: Open Microsoft WebMatrix.

Step 2: Open the site that you have created previously where the database exists. Click on the Database Workspace

Database Workspace in WebMatrix

Note: If you do not have any website and database and you want to start to migrate the database then you can choose the Bakery template to create a site in which the database already exists.

Step 3: Select the Migrate option situated at the Home tab.

Migrate in WebMatrix

Step 5: If you do not have SQL Server then the wizard will help you to install SQL Server. You can select the Authentication in the next procedure of installation depending on the authorization you have. As you can see in the following screenshot the product is required to install.

Installing SQL Server Compact in WebMatrix

Step 6: Follow the instructions and your installation will be successful.

Successful Installation of SQL Server

After clicking OK, the WebMatrix starts the process of migrating your database and table. It will also display a message to notify you that the migration process is completed as in the following::

Migration Report in WebMatrix

Summary

This article described how you can migrate your database to SQL Server and what the steps are to migrate the database. Thanks for reading.

Next Recommended Readings