Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't attach any database to SQL Server 2012

Ok this is what I get:

Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
Additional information: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
CREATE FILE encountered operating system error 5(error not found) while attempting to open or create the physical fife 'C: \Program Fifes (x86) \Microsoft SQL Server \MSSQL.1 \MSSQL \Data \MyCompany.mdf. (MIcrosoft SQL Server, Error: 5123)

I have already reinstalled SQL Server 2012, and it still doesn't work. Before this problem I tried to attach the AdventureWorks database and insert some command (I have deleted it) and since then I keep having this problem. I am new to SQL Server.

Thanks

like image 347
Lazar Lukic Avatar asked Jul 09 '13 16:07

Lazar Lukic


People also ask

Can you attach MDF without LDF?

Attach MDF File Without LDF file by using T-SQL script: You can also run a TSQL Script on SQL Query to restore MDF database in SQL Server and recreate your transaction log file. Where, testdb is the name of your database. Now you can check your database in the database folder.

Why SQL Server is not connecting?

The following common scenarios can cause connectivity problems: Incorrect IP address for the Server field. Make sure that the IP address matches the entry in the SQL Server error log file. Incorrect server name in the Server field.


1 Answers

if you use SSMS try to execute it as Administrator.

like image 111
Max Avatar answered Sep 19 '22 23:09

Max