I'm trying to move an .mdf file out of the standard, cryptic SQL Server Express directory structure into one that I've created myself. First, I tried it using sp_attach_db as follows:
exec sp_attach_db @dbname = N'TrainOfThought', @filename1 = N'C:\Documents and Settings\Curt\My Documents\Visual Studio 2008\Projects\TrainOfThought\data\TrainOfThought.mdf', @filename2 = N'C:\Documents and Settings\Curt\My Documents\Visual Studio 2008\Projects\TrainOfThought\data\TrainOfThought.ldf'
I got an "access denied" error on this operation. I checked the .mdf, but it has no "read only" flag on it. So then I tried this:
RESTORE DATABASE [TrainOfThought] FROM DISK = 'C:\Documents and Settings\Curt\My Documents\Visual Studio 2008\Projects\TrainOfThought\data\TrainOfThought.mdf' WITH MOVE 'TrainOfThought' TO 'C:\Documents and Settings\Curt\My Documents\Visual Studio 2008\Projects\TrainOfThought\data\TrainOfThought.mdf', MOVE 'TrainOfThought' TO 'C:\Documents and Settings\Curt\My Documents\Visual Studio 2008\Projects\TrainOfThought\data\TrainOfThought.ldf' GO
I still got the "access denied" error. What's my next move?