Sql-server – attaching locally stored mdf to SSMS

sql serverssms

Sorry if this question does not make sense, I have no experience with databases, I just stumbled upon this task.

I need to attach an mdf to a database. I have the mdf file stored in my local computer. When I click attach in SSMS, and then add, I can only browse the disks and folders of the SQL Server, while the file is in my local computer. How can I move the mdf file to the sql server?

Best Answer

As Aaron Bertrand says in the comments, having a .mdf file as the method for adding a database to a server is unusual. Normally you should have a .bak backup file. If at all possible, contact your source and ask for backup to restore.

If you have to use an .mdf You need to copy it to the folder on the server, where it will become the .mdf of the database when it is live. Normally you would do this with an RDP or share connection to the folder. Be aware there are several issue you may encounter doing this.

See these related posts for the answer to questions you have not asked yet, but probably will.