Pavol

Pavol

  • NA
  • 23
  • 8.7k

Delete .ndf file

Nov 16 2016 5:00 PM
Hi
I used partitioning on my database. I created filegroup and four files in this filegroup. In this filegroup i dont have data and i need delete .ndf files from this filegroup. Files has 1MB size.
i used this command:
 
ALTER DATABASE MyDatabase REMOVE FILE MyFile
 
i got error :
Error 5042: The file 'MyFile' cannot be removed because it is not empty. 
 
I tried SHRINKFILE('logical_file_name', EMPTYFILE) but i got error:
There is insufficient space in the filegroup to complete the emptyfile operation. 
 
Do you have any idea how i solve this problem. Thanks

Answers (5)