Thursday, July 26, 2012

Northwind-mania: Upgrading Northwind.mdf database file from SQL Server 2005/2008 to LocalDB\v11.0

Visual Studio 2012 comes with a new small light-weight database named LocalDB\v11.0. You can find out the default database used by Visual Studio 2012 by checking out TOOLS >> Options… >> Database Tools >> Data Connections:

image

If you have a SQL2005 or SQL2008 database and wish to use it in a Visual Studio 2012 application, you should upgrade it to LocalDB\v11.0 format. Here’s what I did when I came across this predicament. I used the usual Northwind.mdf SQL2008 database for this post.

- In Visual Studio 2012  “Server Explorer”, right-click on “Data Connections” and select “Add Connections…”

image

- Click the “Change…” button on the “Add Connection” dialog:

image

- Choose “Microsoft SQL Server Database File” then click OK. You will be returned to the “Add Connection” dialog.

image

- Navigate to the location of your Northwind.mdf file by clicking the “Browse…” button, then click OK.

image

- Visual Studio 2012 will detect that the database is not of LocalDB\v11.0 format and will display this message:

image

- Click “Yes” so that your SQL200x database gets upgraded to LocalDB\v11.0. Upon completion of the upgrade process you will be able to view all your database objects in Server Explorer:

image

Hope this helps.

No comments:

Post a Comment