Question

Since we need to move around our database a lot (like update it with new Rows which are generated by code and then update it prod db and reverse process). SQL Server CE, being a file based system was very helpful.

We would like to upgrade to use SQL Server Local Db but at the same time, it has limitations of use with IIS (though possible with AttacheDbFile). In this regard, since LocalDb is more or less a version of SQL Server Express, would it be possible to use our SQL Server LocalDB .mdf in our development environment and then copy them in prod but use by attaching to a SQL Server Express instance?

If yes, what additional thing, we need to do make it possible?

Also, we would like the reverse process to be worked out as well, mean detach the .mdf file and use it as LocalDb in development environment. I have read the great blog articles of Krzysztof Kozielczyk also but not have experimented much with LocalDb.

Was it helpful?

Solution

LocalDB IS SQL Server Express (introduced with SQL Server 2012 Express), and the .mdf file is identical between LocalDB and SQL Server Express (and even a "full" SQL Server edition like Web, Standard or Enterprise Edition).

The only caveat is: you need to be using the same versions of those databases, since the file format is only identical amongst same versions, and can only be used amongst the same versions (e.g. 2012) - or it can be "upgraded" to the next newer version (e.g. you could move a database from LocalDB 2012 to a SQL Server 2014 Express once it's released) - but you can never go back down to an earlier version (you cannot take a LocalDB 2012 .mdf database file and attach it to a SQL Server 2008 version).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top