Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't attach northwind database to sql server 2008 R2

When I try to I get the following error in SQL Server Management Studio:

TITLE: Microsoft SQL Server Management Studio

Attach database failed for Server 'AHAKEEM'. (Microsoft.SqlServer.Smo)

ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

Unable to open the physical file "C:\SQL Server 2000 Sample Databases\northwnd.mdf". Operating system error 5: "5(failed to retrieve text for this error. Reason: 15105)". (Microsoft SQL Server, Error: 5120)

This is a fresh version of Northwinds mdf which just came from Microsoft's installer.

like image 474
meds Avatar asked Apr 04 '12 04:04

meds


1 Answers

Error 5120 is a sharing violation on the file you're opening. Try starting SQL Management Studio as Administrator and make sure that the db isn't attached already.

like image 110
hkf Avatar answered Sep 27 '22 18:09

hkf