Assume you have database called SalesCommission _DB in your SQL Server. You want to change the database files location from C: drive to S: drive due to disk capacity issue.
You can use the ALTER DATABASE statement to move database files within the same instance of SQL Server by including the MODIFY FILE clause in the statement.
The following example shows how to move the data file for the SalesCommission _DB database:
1 2 3 4 5 6 |
ALTER DATABASE SalesCommission _DB SET OFFLINE; ALTER DATABASE SalesCommission _DB MODIFY FILE (NAME = SalesComDataFile, FILENAME = 'S:\SalesCommission _DB.mdf'); ALTER DATABASE SalesCommission _DB SET ONLINE; |
Leave a Comment