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:
sp_databases go
Note: If you do not know the location of the MDF and LDF files use the following to determine:
use <database_name> go sp_helpfile go use master go sp_detach_db 'existing_db_name' go sp_attach_db 'new_db_name', '<path to the database MDF file>', '<path to the database LDF file>' go