LocalDB Help using SQL Server 2008 R2

54 views Asked by At

It is possible to create the database using SQL Server 2008 R2, once created with all tables and stored procedures etc. then copy and paste it into the Visual Studio App_Data folder to be used as localdb?

I found that is very tedious creating the database with tables and stored procedure using the Visual Studio project.

1

There are 1 answers

4
Joel Coehoorn On

You can (sort of) do this, but SQL Server 2008 R2 is no longer supported, has not been supported for a very long time, and recent versions that are still under support are free for databases up to 10GB.

In fact, SQL Server 2008 R2 pre-dates LocalDB. However, I believe LocalDB can still load a SQL Server 2008 R2 database; it's just the actual service will then be running something newer, but at the 2008 R2 (100) compatibility level.

So assuming you move to an actually-supported version, the process looks like this:

  1. Create the database as needed on your server.
  2. Detach the database from the original server.
  3. Copy the associated (now-detached) *.mdf file to the appropriate development location and set the connection string and deployment options you need.

Additionally, for a web project you're almost always better off using Express Edition vs LocalDB anyway.