What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 19197 |  Welcome, Guest!   Register  Login
 Home > Forums > Sql Server > Attach the mdf file in sql server 2005 ...
Agopi.net

Attach the mdf file in sql server 2005

Replies: 3 | Posted by: Agopi.net on 4/27/2010 | Category: Sql Server Forums | Views: 4136 | Status: [Member]  


hi,

Why we need to attach the "mdf" file in sql server 2005? And how to attach and paste the "mdf" file?

Please help me

By
Gopi A


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Vuyiswamb
Vuyiswamb  
Posted on: 4/27/2010 12:37:28 PM
Level: NotApplicable | Status: [Member] [MVP] [Administrator]

We do that in SQL Express. Look at how its done here

http://msdn.microsoft.com/en-us/library/bb264564(SQL.90).aspx

Thank you for posting at DotnetFunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Agopi.net, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Naveenmanam
Naveenmanam  
Posted on: 4/28/2010 2:24:10 AM
Level: Starter | Status: [Member]

1. The SQLClient logic opens a connection to the parent SQL Server Express instance (.\SQLEXPRESS by default).
2. SQL Server Express detects that the User Instance option is set and that there is no user instance for this user.
3. The master and msdb system database files are copied to the user's directory. In Sally's case, the directory will be:

C:\Documents and Settings\Sally\Local Settings\Application
Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS

These files are copied from a template directory that is created when the parent instance is installed. When the user instance starts, the tempdb, log, and trace files are written to this same user directory.
4. The parent instance impersonates the Windows user who is opening the connection and starts a copy of sqlservr.exe running as that user. The location of the system databases is passed as a parameter. The name of the instance is generated. For example: 69651E0A-5550-46.
5. A Named Pipe database connection is established for the new instance. The name is based on the instance name. For example:

\\.\pipe\69651E0A-5550-46\tsql\query.

6. The database file specified in the AttachDBFilename parameter is attached to the new instance and named with the full path to the file:

[C:\MYDBPROJECTS\TESTVB1\TESTVB1\DATABASE1.MDF]

7. The name of the named pipe is passed back to the SqlClient that is opening the connection.
8. When SqlClient receives the name of the connection, it closes the connection to the parent instance. It opens a new connection to the user instance using the returned named pipe name.

NaveenKumar

Agopi.net, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Pavanandey
Pavanandey  
Posted on: 4/28/2010 9:12:46 AM
Level: Bronze | Status: [Member]

Dear Gopi,

Right click on the database on the left hand side of the sql management studio there u will find a option attach click on it,
u will find attache mdf point to the physical location of the mdf file
and click attach

u will find the db attached

Thanks
Pavan Kumar
Mark Answer if this fits the need

Agopi.net, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 9:09:46 PM