I have an .mdf file, and two .ndf files of the same mdf file. Is it possible to merge those files into one single .mdf file without loosing any data ?
Is it possible to merge ndf files and mdf file into one single mdf file?
7.7k views Asked by Mehdi Souregi At
2
There are 2 answers
0
On
Thanks @TheGameiswar for the answer.
If you have for example file1.mdf, file2.ndf and file3.ndf
The way to merge them in one file :
DBCC SHRINKFILE(file2, EMPTYFILE);
GO
DBCC SHRINKFILE(file3, EMPTYFILE);
GO
And then you can remove them safely :
ALTER DATABASE MyDB
REMOVE FILE file2;
GO
ALTER DATABASE MyDB
REMOVE FILE file3;
GO
file1 will contain the whole data after that.
Yes,you can ..use DBCC SHRINKFILE with
Empty
optionFrom MSDN:
Example: