Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Not being able to attach DB in sql server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-09-01 : 07:27:29
Chris writes "I am not able to attach or detach a DB in Sql Server I have tried to detach PUBS DB to show how I am trying to attach and detach DB's and also the error I am getting.
To attach and detach DB's I am using.

exec sp_detach_db @dbname = 'Pubs'
@filename1 = 'C:\PROGRAM FILES\MICROSOFT SQL SERVER\MSSQL\DATA\PUBS.MDF',
@filename2 = 'C:\PROGRAM FILES\MICROSOFT SQL SERVER\MSSQL\DATA\PUBS.LDF'

This is the error message I am getting.

Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'pubs'.

Any info would be appreciated.

Chris"

Thrasymachus
Constraint Violating Yak Guru

483 Posts

Posted - 2005-09-01 : 08:33:10
you only have to specify the dbname for sp_dettach_db.

====================================================
Regards,
Sean Roussy

"pimpin ain't easy, but someone has to do it" -- Pimpin Whitefolks(?)
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2005-09-01 : 09:03:47
The error is because there is no comma after 'Pubs'
If you add that you will get an error that the filenames are not valid parameters

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -