MS SQL Server 2008 R2 Management Studio bug: cannot attach a database
-
9 august 2012 10:59
I can't attach a database in SQL Server Management Studio for MS SQL Server 2008 R2. I try this:
But then I get:
This is obviously a UI bug. But maybe I can attach a database using some sort of T-SQL script?
Toate mesajele
-
9 august 2012 11:18Moderator
Hello,
Run SSMS with the “Run as Administrator” option. Assign sysadmin role to the account you are using to attach the database. For more information, please see the following post:
http://connect.microsoft.com/SQLServer/feedback/details/553392/actual-value-was-1-microsoft-sqlserver-gridcontrol-error-when-attaching-database
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com- Propus ca răspuns de Janos Berke 9 august 2012 11:32
- Anulare propunere ca răspuns de Bogdan Verbenets 10 august 2012 08:22
-
10 august 2012 07:28
Hello,
if you are facing problem using User Interface you can accomplish same using SQL Query.
CREATE DATABASE MyAdventureWorks ON (FILENAME = 'C:\MySQLServer\AdventureWorks_Data.mdf'), (FILENAME = 'C:\MySQLServer\AdventureWorks_Log.ldf') FOR ATTACH;
-
12 august 2012 17:20Moderator
Hi Bogdan,
You could use sp_attach_db to attach a database to a server.
The following example attaches files from AdventureWorks2008R2 to the current server.
EXEC sp_attach_db @dbname = N'AdventureWorks2008R2', @filename1 = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Data\AdventureWorks2008R2_Data.mdf', @filename2 = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Data\AdventureWorks2008R2_log.ldf';For more information, please refer to http://msdn.microsoft.com/en-us/library/ms179877(v=sql.105).aspx.
Thanks,
MaggiePlease remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.
- Marcat ca răspuns de Bogdan Verbenets 13 august 2012 13:43