Link to home
Start Free TrialLog in
Avatar of Jonathan Kaplan
Jonathan KaplanFlag for United States of America

asked on

BCM 2003 attach error message

In order to fix a broken installation of Business Contact Manager 2003, running on XP, I had to copy the MDF and LDF files to another location on the same machine and reinstall BCM. I also installed SQL Studio 2005. When I tried to attach the data to the new database, I get the error msg "Cannot  Attach to a database with the same name". I tried renaming the MDF and LDF files by adding a 1 to the names. That didn't work. I then tried renaming the instance of the Database in Studio and that didn't work. So what can I do to get around this issue? Thanks any and all help.
ASKER CERTIFIED SOLUTION
Avatar of lcohan
lcohan
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jonathan Kaplan

ASKER

I found the following script online and was able attach the Db using it. I think it's essentially the same thing as yours:
"c:\program files\microsoft sql server\90\tools\binn\sqlcmd.exe" -b -E -S .\MSSMLBIZ -Q "EXEC sp_attach_db @dbname = 'Master1', @filename1 = '%LOCALAPPDATA%\Microsoft\Business Contact Manager\Master1.mdf', @filename2 = '%LOCALAPPDATA%\Microsoft\Business Contact Manager\Master1.ldf';">>"%LOCALAPPDATA%\Microsoft\Business Contact Manager\Master1_RestoreResult.txt"
@ECHO Attach DB Returned:%ERRORLEVEL%>>"%LOCALAPPDATA%\Microsoft\Business Contact Manager\Master1_RestoreResult.txt"
@ECHO Attach DB Returned:%ERRORLEVEL%