views:

124

answers:

3

In SQL Server Management Studio, if I attempt to restore a database from a backup file with a command like:

RESTORE DATABASE somedatabase FROM DISK = '<virtual disk>:\<path>\<backup file>';

I get a "file not found" error. I'm creating with the "subst" command. But if I replace with a physical disk and with the complete path, the command works just fine.

Is there any way at all to restore a database from a path that starts with a virtual disk? If so, what is it? If not, how might I work around this issue?

As an aside, the reason for using virtual disks in the first place was to insulate the script from differences across development environments (I'm trying to develop an MSBuild script to automate the creation of local databases for testing.)

+1  A: 

If you can browse to the file in explorer or cmd.exe from the same OS instance where SQL Server is installed, then it should be visible to SQL Server.

gbn
A: 

The drive letter also needs to be visible from the account which the server engine is running under.

What mechanism are you using for the virtual disk?

Cade Roux
The "subst" command is what I'm using to create the virtual disk. It just maps to a location on the C:\ drive.
Scott A. Lawrence
SUBST drive letters wouldn't be visible to the engine, much like mapped network drive letters which are mapped with net use or upon login. There probably are virtual disks which will work, however.
Cade Roux
+1  A: 

As it turns out, this capability isn't supported in SQL Server (unfortunately).

I got this answer from a Microsoft consultant we're working with just a little while ago.

Scott A. Lawrence