0

I developed a C# winforms project with SQL Server database.

My boss told me that target machines had Win 7 and Win 8. So I wasn't worried with system requirements so I used LocalDB with .Net Framework 4.5.1.

Now my boss changed his mind and the project needs to be installed on Windows XP machines.

I know that I need to change the .Net Framework to 4.0, and there will be no problem with that BUT is there a easy way to change the database because I'll need to change probably to SQL Server 2008 R2 .....

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
hi itsme
  • 431
  • 1
  • 9
  • 23

2 Answers2

2

You'll just need to run the create scripts (that create your database objects and possibly fill in some lookup/system default values into the tables) against a SQL Server 2008 R2 instance and then you're done! :-)

If you're using Entity Framework, you can have it create your database on the new target server instance - either using code-first and migrations, or by generating a SQL script to run to create your tables and everything else needed.

You cannot do a "binary" downgrade - you cannot take your SQL Server 2012 LocalDB files and attach them to a SQL Server 2008 R2 instance

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Can you please explain (or give a example ) how to "run the create scripts (that create your database objects and possibly fill in some lookup/system default values into the tables) against a SQL Server 2008 R2 instance " ? – hi itsme Jul 11 '14 at 09:28
2

LocalDB is SQL Server Express 2012. So if you were moving to SQL Server 2012 Standard, you could attach the .mdf file to SQL Server 2012.

In your case, it is a downgrade, so you'll have to unload the data and load into the older DB, using DDL scripts, or use a migration tool that exports to an intermediate format. I like Redgate SQL Source Control, as it stores the object definitions in script format, but if you don't have that, you can use SQL Server Management Studio (SSMS) to connect to LocalDB with something like "(localdb)\v11.0" and then script out your objects as best you can.

codenheim
  • 20,467
  • 1
  • 59
  • 80