Since releasing the latest version of Nerd Dinner into the wild, we’ve had some reports of people having a variety of issues either getting or working with the databases in the source branch. Hopefully, this post will help clear up some of those issues.
First, both of the MDF files should get pulled down with the source. If they aren’t in the App_Data directory, please try to download them again from the source repository. Also, It’s not necessary to explicitly attach these MDF files to the SQL Express instance. The connection string specifies ‘User Instance’ and ‘AttachDBFilename’ properties which spin up a run-time initiated instance of the MDF file.
If you choose to build out your own SQL instance the connection strings will need to be modified to remove the ‘User Instance’ and ‘AttachDBFilename’ properties and include the ‘Initial Catalog’ property pointing to the database you created on your server. Something like:
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;MultipleActiveResultSets=True;
Next, If you’re getting this error:
“The database ‘NERDDINNER.MDF’ cannot be opened because it is version 661. This server supports version 662 and earlier. A downgrade path is not supported.Could not open new database ‘NERDDINNER.MDF’. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 948)”
You have SQL Express 2008 SP2 installed and not SQL Express 2008 R2. Really the way this error should read is:
“The database cannot be opened because it is version 661. This server supports versions 662, 655 and earlier than 655. A downgrade path is not supported.”
My understanding is that SQL Server 2008 SP2 and SQL Server 2008 R2 databases are not interchangeable because a feature introduced in SP2. Part of the confusion, for me, is with the version numbers. R2 is the ‘latest and greatest’, but has a lower data format version #. Here’s a table of the various versions of SQL Server 2008 and their data format version #s.
• SQL Server 2008 R2 (v 10.50.1600) data format version # 661
• SQL Server 2008 SP2 (v 10.00.400) data format version #662
• SQL Server 2008 (v 10.00.1600) data format version #655
The MDF files included in the Nerd Dinner source are from SQL Express 2008 R2. If you find that you don’t have R2 installed there are two ways of remedying this scenario, first would to be to upgrade the SP2 instance to R2. Or you could manually build out the DB on SP2, in which case you would need to build some mechanism of importing the schema.
If you choose to build-out your on SQL instance here are the schema scripts for creating the DBs.