Solved

what is the syntax for sp_detach

Posted on 2004-09-22
2
1,980 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS SQL - Rotating Values in SQL 9 53
Get Duration of last Status Update 4 31
SQL Select Statement 2 22
Need a starter for ETL protocol? 4 43
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…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now