M-salem M-salem - 1 year ago 60
SQL Question

Deleting NDF from file group completely?

I want a script to delete NDF file from a file group completely without using "shrinkfile " command

Answer Source

A file can be removed from the database only if the file is empty. Without SHRINKFILE, the implication is that the file must be the only file in a user-defined filegroup and you must first drop or move all the objects (or partitions) from the filegroup to a different file group. The empty file can then be dropped with ALTER DATABASE...REMOVE FILE.

It seems your objective is to delete data older than 6 months. It would be easier to just delete/truncate the data and not bother with files/filegroups at all.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download