Detaching and reataching a SQL Server Database

I thought I would share some directions on detaching and reatching a database from the osql (SQL 7, 2000, MSDE) command line or the SQL 2005 the sqlcmd command line.

osql into the server: (i.e. – osql -u sa -p password)

Display all databases on the server:

Note:  If you do not know the location of the MDF and LDF files use the following to determine:


Leave a Reply