We have a SQL Server database with two filegroups;
SECONDARY, with a single file in each file group.
All the clustered indexes are stored in the secondary filegroup. How can we remove the
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.Sign up to join this community
The clustered index structure is the table in SQL Server.
In order to remove a filegroup, you first need to remove all data from the filegroup. There are several ways of doing that, including using the GUI, like this:
Be aware, this method will result in SSMS generating code that actually drops-and-recreates the table.
An alternate method of doing that would be to rebuild the indexes for the table, specifying the target filegroup in the rebuild command. I've written a blog-post showing the code I use to accomplish that over at SQLServerScience.com