简体   繁体   中英

Export SQL database to MDF to use as local file in VS2010 error

I want to get a MS SQL database from SQL Server 2008 R2 to an MDF to use locally in a program. I detached the DB and manually copied the MDF, but whenever I try to open it up in VS, I get an error that it cannot be opened because it is version 661. I received the data as a CSV, used Access to import it and exported it to a local SQL implementation. Most importantly, what am I doing wrong?

Also, I was wondering if there is a more efficient way to create an MDF file from a CSV?

Thanks!

Spencer

Well, as I said - the basic approach is OK - detach the MDF, copy the file, open it as a local database in Visual Studio.

BUT: it would appear that you're trying to use a SQL Server 2008 R2 MDF file, but the SQL Server version that Visual Studio 2010 supports/installs is SQL Server 2008 Express.

You cannot go from a newer SQL Server version (2008 R2 ) back to an older version (SQL Server 2008 ) - this is not supported.

One possible way to solve this would be to explicitly uninstall SQL Server 2008 Express that Visual Studio 2010 installed, download the SQL Server 2008 R2 Express version from Microsoft's web site and install it (as the .\\SQLExpress instance, as did Visual Studio).

Once you have the same version of SQL Server - both on your main server as well as from within Visual Studio, then you should be able to achieve what you're looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM