Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't attach .mdf into sql server management

Why can't I browse deeper into the folder, I still have some folders there: alt text http://img168.imageshack.us/img168/3056/mdf.jpg

like image 648
aherlambang Avatar asked Apr 05 '10 17:04

aherlambang


People also ask

How do I import MDF files into SQL Server Management Studio?

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.

Can you attach MDF without LDF?

There are mainly two methods to attach SQL MDF file without LDF manually. Attach MDF File Without LDF file by Using SSMS: You can attach your SQL MDF file without LDF by following underlying steps. In Attach Databases Windows, Click on Add button to import MDF file in SQL server.

How do I install an NDF file in SQL server?

Expand Databases, right-click the database from which to add the files, and then click Properties. In the Database Properties dialog box, select the Files page. To add a data or transaction log file, click Add.

How do I get MDF and LDF files in SQL server?

The mdf and ldf can be set for each Microsoft SQL database, by right-clicking on the database, in Microsoft SQL Server Management Studio and selecting Properties. In the Database Properties Select Files. In this window, the current settings for the mdf and ldf are displayed.


2 Answers

Your SQL Server service account likely does not have access to the folder you're attempting to browse. The ideal solution (from a security perspective) would be to move the file to another, non user-specific location. However, what you're trying to do can be done.

  1. Determine the SQL Server instance service account. To do this, view your computer's services and locate "SQL Server" or "SQL Server (instancename)". Double-click and select the "Log On" tab to determine the account being used.
  2. Starting with the user's folder, alter the security to grant read and browse permission to the user located in step 1. You'll need to do this for each folder in the path, starting with the the user (in other words, if it's in C:\Documents and Settings\user\Desktop, you'll have to do this on user and Desktop).
  3. Locate the specific file you wish to attach and grant read and write privileges to the same account.

To alter the permissions on a folder or file, right-click and select "Properties", then the "Security" tab. You can add additional permissions by clicking "Add..." and locating the user that you want to explicitly grant (allow) or deny permissions to.

like image 191
Adam Robinson Avatar answered Sep 22 '22 06:09

Adam Robinson


I had a mdf file on my desktop but couldn't access it either due to not being able to browse deeper.

I solved it by going to

start > all programs > Microsoft SQL Server 2008 R2 > Sql Server Configuration Manager

within the Sql configuration manager I went to SQL Server Services and double clicked on the instance running > Log On > change built-in account to 'Local System'. Mine was set to network services but as soon as a changed it to local system I could access my desktop and all my user files.

like image 41
reversebind Avatar answered Sep 21 '22 06:09

reversebind