-1

I apologize for my silly question. I have an mdf file but I am not able to open it. i have downloaded both "mysql workbench" and "microsoft server sql".
Should I attach first my file? In SQL Server Management Studio Object Explorer, I right-click on databases and I click Attach....but i don't understand why my mdf file doesn't appear at all

Mike Lischke
  • 48,925
  • 16
  • 119
  • 181
antonio
  • 77
  • 10

1 Answers1

1

MDF is the data part of and SQL Server Database. You need to attach that DB to SQL Server. In order to do this you need also a LDF File (Transaction log). Hope this help.

EDIT If you don't have the LDF, try this on SQL Server:

CREATE DATABASE SomeDB
ON (FILENAME = 'c:\data\SomeDB.mdf')
FOR ATTACH

EDIT 2 Open SQL Server Management Studio. Connect to Server, then go to to the button "New Query". In the window that open paste the code i give you and change path and name of MDF file.

ericpap
  • 2,917
  • 5
  • 33
  • 52
  • If i need an LDF file, how can I create it? – antonio Mar 20 '14 at 16:55
  • Thank u very much. Now know where to launch queries... (I am newbie as you have realized...). Like In SQL Server Management Studio Object Explorer it appears that my file doesn't exist.... The following error message appears: `Msg 5133, Level 16, State 1, Line 1 Directory lookup for the file "c:\Users\asaponar\Desktop\antonio lon\ION_Data_Archivemarch.mdf" failed with the operating system error 5(Access is denied.).` **Maybe I should change some options during the installation or/ access options...?, Do u know how to do it?** – antonio Mar 21 '14 at 11:03
  • How can I include my account in the administration group? – antonio Mar 21 '14 at 12:13
  • SQL gives you that error when you execute the CREATE DATABASE Command? Looks like an operation system error for accesing the file. Check operation system file permission for the MDF file. I think you need to take ownership of the file. – ericpap Mar 21 '14 at 13:53
  • what do you mean take ownership of the file? I have changed all the security permission of the file – antonio Mar 21 '14 at 15:59
  • Just make sure you can read the file and try to make the attach again. Look at this post: http://stackoverflow.com/questions/2330439/access-is-denied-when-attaching-a-database. Also try running the command as SA. – ericpap Mar 21 '14 at 18:32
  • I have been able to attach it...now how could I see the data? – antonio Mar 24 '14 at 12:43
  • What do you wnat to do with the data? If you attach de database you should be able to explore tables and data on tables, make querys, etc. – ericpap Mar 24 '14 at 15:03