Hot Lines: +92 321 8488 463 & +1 786 2179 794
Portal HomeClient AreaAnnouncementsKnowledgebaseSupport TicketsDownloads

Knowledgebase
You are here: Portal Home > Knowledgebase > Data Bases > How To Attach Data Bases SQL server 2005

How To Attach Data Bases SQL server 2005

SQL Server 2005 Books Online (November 2008)
How to: Attach a Database (SQL Server Management Studio)

This topic describes how to attach a database. Attaching a database places it in exactly the same state that it was in when it was detached.

Security Note: We recommend that you do not attach or restore databases from unknown or untrusted sources. Such databases could contain malicious code that might execute unintended Transact-SQL code or cause errors by modifying the schema or the physical database structure. Before you use a database from an unknown or untrusted source, run DBCC CHECKDB on the database on a nonproduction server and also examine the code, such as stored procedures or other user-defined code, in the database.

  1. In SQL Server Management Studio Object Explorer, connect to an instance of the Microsoft SQL Server Database Engine, and then expand that instance.

  2. Right-click Databases and click Attach.

  3. In the Attach Databases dialog box, to specify the database to be attached, click Add; and in the Locate Database Files dialog box, select the disk drive where the database resides and expand the directory tree to find and select the .mdf file of the database; for example:

    C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\AdventureWorks_Data.mdf

    ms190209.note(en-US,SQL.90).gifImportant:
    Trying to select a database that is already attached generates an error.

  4. Optionally, to specify a different name for the database to attach as, enter the name in the Attach as column of the Attach Databases dialog box.

  5. Optionally, change the owner of the database by selecting a different entry in the Owner column.

  6. When you are ready to attach the database, click OK.

    ms190209.note(en-US,SQL.90).gifNote:
    A newly attached database is not displayed in the Databases node of Object Explorer until the view is refreshed. To refresh the view at any time, click in Object Explorer, and then click Refresh on the View menu.



Was this answer helpful?

Add to Favourites
Print this Article

Also Read
How To create Sql Data Base In Plesk (Views: 157)
What is differnce between Mysql And Mssql (Views: 199)
How To connect the Sql Data Base remotely (Views: 105)
How to connect to the MySQL server remotely (Views: 119)
How to connect to the MySQL database (Views: 114)

Powered by WHMCompleteSolution


Language:

Copyright © 2011 NavicoSoft , All rights reserved.