
Change Microsoft SQL Server Data Location
Let’s say you have an existing Microsoft SQL data and want to move it to a different disk or directory. Running the query below shows the logical name and the file location of your schema. SELECT name AS FileLogicalName, physical_name AS FileLocation FROM sys.master_files WHERE database_id = DB_ID('HR'); Existing Location FileLogicalName FileLocation HR C:\MSSQL_DATA\OldPath\HR.mdf HR_log C:\MSSQL_DATA\OldPath\HR.ldf Target New Location FileLogicalName FileLocation HR D:\MSSQL_DATA\MSSQL15.MSSQLSERVER\MSSQL\Data\HR.mdf HR_log D:\MSSQL_DATA\MSSQL15.MSSQLSERVER\MSSQL\Data\HR.0.ldf Steps to move the database files Take the database offline ...