I had to recover my computer but before I did that I grabbed a new version of my mdf file but I don't know how to actually import it into SQL Server Management Studio Express evertime I try to open the file up it just crashes.
I rather not have to redue that whole database again. I am a noob so step by step instructions are needed.
Open SQL Management Studio Express and log in to the server to which you want to attach the database. In the 'Object Explorer' window, right-click on the 'Databases' folder and select 'Attach...' The 'Attach Databases' window will open; inside that window
click 'Add...' and then navigate to your .MDF file and click 'OK'. Click 'OK' once more to finish attaching the database and you are done. The database should be available for use.
Open SQL Management Studio Express and log in to the server to which you want to attach the database. In the 'Object Explorer' window, right-click on the 'Databases' folder and select 'Attach...' The 'Attach Databases' window will open; inside that window
click 'Add...' and then navigate to your .MDF file and click 'OK'. Click 'OK' once more to finish attaching the database and you are done. The database should be available for use.
This is true. One important note I would like to menion is, it is highly recomended to take a copy of .mdf file bedore attaching it to the new database. Why? Because if this .mdf file was one of the SQL Server 2000 databases and you attached it to one of
the SQL Server 2005 databases. There is no way -if you wish in futute- to detach that .mdf file from SQL Server 2005 and attached it again in SQL Server 2000 or eailer version.
Good luck.
Regards,
CS4Ever
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will ALL know you have been helped.
This will help me, you and others.
Hello, I am a COMPLETE noobie. I am using visual web developer 2005 and a template website for a club. This template uses two sql server express databases (from what I understand); aspnet.mdf (for the user data / permissions, etc.), and my application
(content) database. I got the website compiling without error on my local machine. I purchased hosting from DiscountASP.net, which was a featured provider on the asp.net forums and downloads sites. I was allowed by my club to purchase one sql server access
from the host for an additional $10/month. The website does not work on the host, I found out due to only the aspnetdb.mdf file being uploaded to the sql server on the host. I have been told I need to MERGE the aspnetdb.mdf and my club.mdf databases into
one and then install it on the host sql server. My question is how to do this? I have been told to use the sql server management studio express, do this and that (like what is told in this forum) and all will be right with the world. I cannot get past how
to make this management tool to see my database in the first place. Could someone please help me?! I was given control of my club's website a week ago and told not to have it down too long, so I am under a time crunch.
chobo2
Member
16 Points
615 Posts
How to import an mdf file into SQL Server Management Studio Express?
Aug 17, 2007 09:43 PM|LINK
Hi
I had to recover my computer but before I did that I grabbed a new version of my mdf file but I don't know how to actually import it into SQL Server Management Studio Express evertime I try to open the file up it just crashes.
I rather not have to redue that whole database again. I am a noob so step by step instructions are needed.
Thanks
aggiekevin
Contributor
2126 Points
418 Posts
Re: How to import an mdf file into SQL Server Management Studio Express?
Aug 17, 2007 10:31 PM|LINK
Open SQL Management Studio Express and log in to the server to which you want to attach the database. In the 'Object Explorer' window, right-click on the 'Databases' folder and select 'Attach...' The 'Attach Databases' window will open; inside that window click 'Add...' and then navigate to your .MDF file and click 'OK'. Click 'OK' once more to finish attaching the database and you are done. The database should be available for use.
http://www.myviewstate.net
chobo2
Member
16 Points
615 Posts
Re: How to import an mdf file into SQL Server Management Studio Express?
Aug 18, 2007 03:17 AM|LINK
Thanks but I get an error.
[IMG]http://img137.imageshack.us/img137/7458/failedqx3.jpg[/IMG]
[IMG]http://img529.imageshack.us/img529/3024/failed1pe4.jpg[/IMG]
[IMG]http://img145.imageshack.us/img145/4746/failed3do8.jpg[/IMG]
chobo2
Member
16 Points
615 Posts
Re: How to import an mdf file into SQL Server Management Studio Express?
Aug 18, 2007 05:14 AM|LINK
I think I got it working.
CS4Ever
Contributor
2666 Points
465 Posts
Re: How to import an mdf file into SQL Server Management Studio Express?
Aug 22, 2007 03:43 AM|LINK
This is true. One important note I would like to menion is, it is highly recomended to take a copy of .mdf file bedore attaching it to the new database. Why? Because if this .mdf file was one of the SQL Server 2000 databases and you attached it to one of the SQL Server 2005 databases. There is no way -if you wish in futute- to detach that .mdf file from SQL Server 2005 and attached it again in SQL Server 2000 or eailer version.
Good luck.
CS4Ever
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dont forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will ALL know you have been helped.
This will help me, you and others.
chobo2
Member
16 Points
615 Posts
Re: How to import an mdf file into SQL Server Management Studio Express?
Aug 22, 2007 06:27 PM|LINK
Thanks
rcflyerb
Member
6 Points
16 Posts
Re: How to import an mdf file into SQL Server Management Studio Express?
Mar 12, 2008 01:42 AM|LINK
Hello, I am a COMPLETE noobie. I am using visual web developer 2005 and a template website for a club. This template uses two sql server express databases (from what I understand); aspnet.mdf (for the user data / permissions, etc.), and my application (content) database. I got the website compiling without error on my local machine. I purchased hosting from DiscountASP.net, which was a featured provider on the asp.net forums and downloads sites. I was allowed by my club to purchase one sql server access from the host for an additional $10/month. The website does not work on the host, I found out due to only the aspnetdb.mdf file being uploaded to the sql server on the host. I have been told I need to MERGE the aspnetdb.mdf and my club.mdf databases into one and then install it on the host sql server. My question is how to do this? I have been told to use the sql server management studio express, do this and that (like what is told in this forum) and all will be right with the world. I cannot get past how to make this management tool to see my database in the first place. Could someone please help me?! I was given control of my club's website a week ago and told not to have it down too long, so I am under a time crunch.
Please help!
Bryan Saldana
D.Karuna
Member
2 Points
1 Post
Re: How to import an mdf file into SQL Server Management Studio Express?
Jun 25, 2012 03:43 AM|LINK
Thank you!
TgaLamx
Member
25 Points
61 Posts
Re: How to import an mdf file into SQL Server Management Studio Express?
Nov 08, 2012 02:18 AM|LINK
use aspnet_regsql -? found in the .net 2.0 directory to add asp.net membership info onto your db file,
Shailendra S...
Member
551 Points
145 Posts
Re: How to import an mdf file into SQL Server Management Studio Express?
Nov 08, 2012 04:33 AM|LINK
USE [master]
GO
CREATE DATABASE [YourDB] ON
( FILENAME = N’C:\Data\yourdb.mdf’ )
FOR ATTACH
GO
www.techaray.com