Do not use on any
shared computer
September 5, 2008 10:28pm pdt
 
[x]
Attachment Details

Can't Attach SQL Server Express File

Experts,

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?
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: NigelRocks
Question Asked On: 07.22.2008
Participating Experts: 1
Points: 500
Views: 0
Translate:
Loading Advertisement...
 
[+][-]Expert Comment by mark_wills

Rank: Master

Expert Comment by mark_wills:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by NigelRocks
Author Comment by NigelRocks:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by mark_wills

Rank: Master

Expert Comment by mark_wills:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Author Comment by NigelRocks
Author Comment by NigelRocks:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by mark_wills

Rank: Master

Expert Comment by mark_wills:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
[+][-]Expert Comment by mark_wills

Rank: Master

Expert Comment by mark_wills:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080723-EE-VQP-34 / EE_QW_2_20070628