Wednesday, March 28, 2012

how to transform an .MDF database into a permanent database in sql server express?

Hi, i have a MDF file used by an asp.net application (with sql server 2005 express).

I want to make it to a permanent database in sql server express.

I know that i can attach it from Management Studio, but is there no better way?

Does it exist a way to 'import' or 'migrate' or copy' a .MDF.database into the central sql server, as if created directly in sql server express? After that, i can delete the .MDF file.

Thanks

Tartuffe

Hello,

if you would create a new database with SQL Server, it will also create an .mdf-file. You can see this for yourself in the following location:

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data

So, I'm not sure what your problem is with the mdf files, but they are perfectly normal SQL Database files and attaching is therefore a good way to bring your database online. If you want, you can first also create a brand new database first, and then import the date. In Management Studio you can right click the new database in the Object Explorer, select tasks > import data... and it should start the SQL Server Import and Export Wizard. Since it's a wizard, I think you will be able to perform the task as you see fit.

Good luck!

|||

Hi, thanks for replying.

Unfortunately, i have Management Studio express and when rightclicking on the new created db, i can't see Import, only backup/restore shrink ...

|||

Hi tartuffe2,

I my opinion, using attach database is the best way for this scenario.

SQL Server 2005 has many ways to implement move, copy, and update database, such as detach/attach, backup/restore, import/export, database mirroring, log shipping, replication. But some of them do not support in Express Edition. For your request, attach is the fastest and simplest way.

Thanks.

No comments:

Post a Comment