Solved

what is the syntax for sp_detach

Posted on 2004-09-22
2
1,985 Views
Last Modified: 2010-05-18
what is the code to detach a database and reattach a database?
0
Comment
Question by:CFDevHead
2 Comments
 
LVL 15

Accepted Solution

by:
jdlambert1 earned 75 total points
ID: 12125969
If the name of the database is "Test" and you're going to keep the LDF, and the mdf and ldf are in the "C:\MSSQL\Data" directory:

sp_detach_db Test

sp_attach_db 'Test', 'C:\MSSQL\Data\Test_data.mdf', 'C:\MSSQL\Data\Test_log.ldf'
0
 
LVL 15

Assisted Solution

by:mcmonap
mcmonap earned 50 total points
ID: 12125989
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SqlServer Table Triggers 3 28
MS SQL Sever Import/export problem 7 44
Help needed in sql query 4 26
Many to one in one row 2 35
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question