Mounting a Database in SQL Server

pts.
Tags:
Development
SQL Server
Could anybody help me. I created a mdf file in one system in my project directory using local server. I copied the same file to another system Project directory, where SQl Server installed. Now, I am not able know how to mount this copied database in the local server. Plase help me at the earliest.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Look at the sp_attach system proc in SQL books online.

I’ve found it easier to use Backup/Restore. You may need to reset user logins after you copy the DB.

All the answers are in SQL books online.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Randym
    If you have the SQL Server enterprise manager and assuming you detached and copied the file (didn't copy a backup file) from the other server, simply right click on the database subfolder, go to all tasks and attach database. You can browse for the .mdf file and then change the locations of the data and log files if needed. You may need to fix orphaned users.
    1,740 pointsBadges:
    report
  • Ve3ofa
    if you are using vs2003 or vs2005(beta) your installation script (click-once) should handle this by itself.. biggest concern is the database instance name.. with vs2005 it defaults to sql_express and you will have to change all references to this to the instance of the database installed i.e. master.. you can have one instance of sql server with many databases (attached) or use a specific instance of a database and then mount the .mdf file (actual database).. this all depends upon security/program needs.
    80 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following