Lars Holdgaard
Lars Holdgaard

Reputation: 9966

Pick a physical location for a single database in Management Studio

I have the following issue: I am working on a Macbook Retina with 250gb harddisk space, and 10gb left.

Now, I just got a new customer, who runs their SQL Server database locally (./SQLEXPRESS). Problem is their database is 110gb.

That means I am forced to work on an external harddrive on some databases, but I do not want this when I work with my other customers who have less than 50mb databases.

So my question is: how to pick a physical location for a single database in Management Studio?

Upvotes: 1

Views: 46

Answers (1)

Andomar
Andomar

Reputation: 238078

When you restore a database, you can specify where to locate the databases' files. This is done with the move option of the restore command:

RESTORE DATABASE YourDb
   FROM DISK = 'D:\YourDb.bak'
   MOVE 'YourDb_Data' TO 'c:\newdir\YourDb_Data'
   MOVE 'YourDb_Log' TO 'c:\newdir\YourDb_Log'
   WITH RECOVERY;

In SSMS, you can do set the target location in the Files tab of the restore wizard. Edit the Restore as column to change the destination.

Upvotes: 2

Related Questions