How can I keep ldf and mdf in two different drive?

359 Views Asked by At

I have a database on SQL Server and I want to keep it's mdf and ldf files in two different path. For doing this, I detacheh my database and copied the ldf file in the other drive, and then I attached the mdf file again. and then I use this code:

ALTER DATABASE mytbl
MODIFY FILE (NAME=mytbl, FILENAME= 'D:\mytbl.ldf');
GO

But it threw an error and couldn't change the ldf directory. What should I do for changing only ldf location?

0

There are 0 best solutions below