Error -
mdf file can not be opened because it is version 655, this version
support 612 or earlier
Note :
I am created this database file using SQL Server 2005 and later that file is opened in SQL Server 2008 then automatically change version from 612 to 655.
But I currently want to open that file in SQL Server 2005.
Any solution is possible then help me.
Upgrading an mdf is a one-way process. You'll have to go back to a backup, an earlier version of the file or recreate it.
I'm guessing you don't have backups or an earlier version of the file (nobody posting "how do I get something back" on these sites knows what a backup is).
As far as recreating goes, you can attach the database to a SQL Server 2008 instance (or later) and then use SQL Server Management Studio to export the database into a blank database on an '05 instance.
From within Management Studio use the Generate Scripts Wizard. You can use this wizard to build queries that will reconstruct the database. Make sure you choose to script Schema and Data and set the destination server version as SQL Server 2005.
Alternatively, you can use the SQL Server Import and Export Wizard although it may not bring all your database objects across.
Related
Please help me about this.. I use to attach a database but it has an error this is the error. And I use SQL Server 2012
Microsoft SQL Server Management Studio
Attach database failed for Server 'DANICA-PC\SQLEXPRESS'.(Microsoft.SqlServer.Smo)
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
The database 'MTS' cannot be opened because it is version 782. This server supports version 655 and earlier. A downgrade path is not supported.
Could not open new database 'MTS'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 948)
You cannot do this - you cannot attach/detach or backup/restore a database from a newer version of SQL Server (the mdf file is version 782 - this is SQL Server 2014) down to an older version (version 655 is SQL Server 2008) - the internal file structures are just too different to support backwards compatibility.
You can either get around this problem by
using the same version of SQL Server on all your machines - then you can easily backup/restore databases between instances
otherwise you can create the database scripts for both structure (tables, view, stored procedures etc.) and for contents (the actual data contained in the tables) either in SQL Server Management Studio (Tasks > Generate Scripts) or using a third-party tool
or you can use a third-party tool like Red-Gate's SQL Compare and SQL Data Compare to do "diffing" between your source and target, generate update scripts from those differences, and then execute those scripts on the target platform; this works across different SQL Server versions.
I would try scripting out the tables and data and then creating it in SQL Server 2012 so you'll have a compatible version. You are trying to attach a SQL Server 2014 database with SQL Server 2012. The database is incompatible with your SQL Server.
I created a project a while ago and transferred it to my other computer, and now it's stopped working. I can't manage to fill the grid with the data from the .mdf.
I have struggled a while with this problem and I can't manage to solve it. I would appreciate if someone here could download the .rar and help me solve this problem.
http://www.filefactory.com/file/3wabxfsyxign/n/CDapplikation_uppgift_rar
.mdf are SQL Server data files; for working with those files, you must have some version (other than Compact Edition) of SQL Server installed
So to get this data out:
check to see what version of SQL Server you have installed
fire up the management tool, e.g. SQL Server Management Studio (possibly the Express version which you can find by searching on Google or Bing and download for free from Microsoft)
attach the .mdf file to the SQL Server under a logical name, so that you can use it
now you can access it using raw ADO.NET or Entity Framework or whatever other data access technology you wish to use
I'm very new to creating installers. This application needs to connect to a SQL Server database for it to be used. The tables of that database has rows which are needed by the application, so just reconstructing the database structure is not what is needed.
Can I just export the database as a .mdf file and connect from there?
Or do I need to install SQL Server Express on those computer as a prerequisite and attach the database from there? If so, how do I attach it on installation?
Or are there other ways to include a SQL Server database to an installer and be used by the installed app?
On the target machines you need to install SqlServer (express or standard).
You don't need any management application like Sql Server Management Studio.
Then you can attach your MDF to the database engine via connection string as this one
Server=.\SQLExpress;AttachDbFilename=c:\yourfolder\yourfile.mdf;Database=yourdatabase; Trusted_Connection=Yes;
The installation of SqlServer is not an easy task to do via custom installers.
If your application is not intended to be used outside of the local machine you could use LocalDB.
The install of this flavor of sqlserver is more easy.
Other alternative is:
Extract a sql script that rebuilds your database. (and provide a method to execute the script)
Export the data needed and execute a bulk insert to reinsert the data in the rebuilded database
I'm using Visual Studio 2005. I create a project, not Web Project, just Windows application.
I remember that Access Database File can be added into a project. I don't need connection to server, data can be retrieved. And I want to do the same thing with SQL Database file.
I did the following steps:
Right-click on project.
Choose Add An Existing Item
Browse for *.mdf file.
DataSource Config Wizard appears and it displays this Message
An error occurred while retrieving the information from the database:
Failed to generate a user instance of SQL Server due to a failure int starting the process for the user instance. The connection will be closed.
I need help to add mdf file into my project.
To start with, and MDF file can be read only by an instance of SQL Server. If you deploy MDFs, then your application must either connect to a SQL Server provided by your end-user during setup, or it must deploy its own instance, in the later case a SQL Server Express Edition instance. See How to: Install SQL Server Express. With Visual Studio 2008 you can add a prerequisite to your own application setup MSI, see "Installing" the SQL Server 2008 Express ClickOnce Bootstrapper for Visual Studio 2008 SP1.
A second issue is that, despite the wide belief of the contrary, distributing the MDF alone without the LDF can land you into a world of pain. You can end up distributing an inconsistent MDF that needs the LDF to finish recovery and get into a consistent state.
But a more serious issue is your plan to deploy binaries (MDFs) instead of scripts for database deployment. This is doomed to fail. As soon as you'll plan to release v. 1.1 of your application you'll face the non-trivial problem of how to replace the user MDF (which now contains data added by the user) with your new MDF. This is why is much much better to deploy upgrade scripts always, and forget about the MDF in your project.
You can read from an Access file (*.mdb) in your app without any other requirements because the core Jet engine used by Access is included as part of Windows — it's built in. Sql Server is not included as part of Windows, and so you cannot use an *.mdf file in your app unless Sql Server has been installed and you have appropriate permissions for it.
It is possible to distribute either Sql Server Express Edition or Sql Server Compact Edition (recommended) with your app. Another option is SqlLite, which has a fully-managed database engine available.
An .MDF is a sql server DB, not MS Access. MS access is .MDB. You cannot read an .MDF on its own. It needs a log file (.LDF) as well. If you attach it to your local instance, it will create a new one for you. You can then connect to that DB.
To solve deployement problem (Updated version of your .mdf file and Code), you can have a utility in your application which can create .xls file of every table(Backup your database) which you used in your application. Now you can easly import those .xls file in SQL Server and create new version of .mdf file and attach same file in latest code.Now new release of your app ready to deploye..!
I installed Sql Server Express 2008 R2, and created a database file in Sql Server management Studio. Now From Visual Studio 2008 I try to connect, but it fails with error:
Unable to open the physical file
"C:.....mdf". Operating system error
32: "32(The process cannot access the
file because it is being used by
another process.)". An attempt to
attach an auto-named database for file
C:....mdf failed. A database with the
same name exists, or specified file
cannot be opened, or it is located on
UNC share.
...This is first time I use Express. I only used Sql Compact Edition before. Are there some settings here I need to figure out? It's not a duplicate name of other connection, and I have closed management studio completely. Still this error. What am I missing..?
If there are some settings, please give a little detail how I access them, as I'm not used to dealing with databases.
SQL CE is a file based database - SQL Express isn't.
It is a SQL Server - you can add it using the Server Explorer in Visual Studio.
The instance name is normally .\SqlExpress.
I faced the same issue today, and guess what daemon tools was the reason for this problem, so if you have installed daemon tools uninstall it and then try again.
Hope it solves your problem too.
You do not want to be connecting using the mdf. What you want to do is Open a SqlClient.SqlConnection and then using the SqlClient.SqlCommand execute queries on the database, and then read the information using the SqlClient.DataReader, just like you would with A SqlCE database.
If you are trying to add it to the Server Explorer you just need to connect to the database just like you would in SSMS (Management Studio) and then you can use it in your project.
If you created a database in SQL Server, you probably have it attached. In Visual Studio you cannot access this database as a file. You have to access it as an attached database (i.e. by its name).
Generally you can use database in files as well in Express edition. If you for some reason want to use file directly, then go to Management studio, right click on your database and detach it. Then you can connect to it from Visual Studio on file basis.