Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

SQL Server Error 1720: Cannot Drop Filegroup Fix

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

SQL Server error 1720 means you are trying to drop a FILESTREAM filegroup or partition scheme while objects still depend on it. The fix is to remove every dependent object first — the partition scheme, any tables or indexes using the filegroup, and the FILESTREAM column itself — then drop the filegroup. You cannot force the drop; SQL Server protects the dependency chain, so you work from the outside in until the filegroup is empty and unreferenced.

What You'll Need

  • Membership in the sysadmin fixed server role or db_owner on the target database, plus ALTER permission on the database.
  • SQL Server Management Studio (SSMS) or Azure Data Studio connected to the instance.
  • A current backup of the database — dropping filegroups and moving FILESTREAM data is destructive and not easily undone.
  • The exact names of the filegroup, partition scheme, tables, and FILESTREAM columns involved. You can find them with the queries in Step 1.

Step-by-Step

  1. Identify the filegroup and confirm it is FILESTREAM. In SSMS, right-click the database, choose Properties, and open the Filegroups page. FILESTREAM filegroups are marked as such. Alternatively run:
    SELECT name, type_desc, is_default FROM sys.filegroups;
    The type_desc value FILESTREAM confirms it.
  2. Find every partition scheme that uses the filegroup. Run:
    SELECT ps.name AS partition_scheme, ds.destination_id, fg.name AS filegroup
    FROM sys.partition_schemes ps
    JOIN sys.destination_data_spaces ds ON ds.partition_scheme_id = ps.data_space_id
    JOIN sys.filegroups fg ON fg.data_space_id = ds.data_space_id
    WHERE fg.name = 'YourFilegroupName';

    Note every scheme returned.
  3. Find tables and indexes that reference the partition scheme or the filegroup. Check both partitioned and non-partitioned objects:
    SELECT OBJECT_NAME(i.object_id) AS object_name, i.name AS index_name, i.type_desc
    FROM sys.indexes i
    JOIN sys.data_spaces ds ON ds.data_space_id = i.data_space_id
    WHERE ds.name = 'YourFilegroupName' OR ds.name = 'YourPartitionSchemeName';

    Also check sys.partitions for any partition whose data_space_id matches the filegroup.
  4. Back up the database. Take a full backup and, if the database is in FULL recovery, a log backup. Dropping a filegroup that contains data is irreversible without a restore.
  5. Move or rebuild dependent indexes off the partition scheme. For each index returned in Step 3, rebuild it onto a different filegroup or onto [PRIMARY] using CREATE INDEX ... WITH (DROP_EXISTING = ON) ON [NewFilegroup]. You cannot drop a partition scheme while any index still uses it.
  6. Drop the partition scheme. Once no index references it, run:
    DROP PARTITION SCHEME YourPartitionSchemeName;
    If error 1720 still appears, repeat Step 3 — a dependent index or table was missed.
  7. Remove FILESTREAM columns from tables. FILESTREAM data lives in a FILESTREAM column, and that column's filegroup must be dropped before the filegroup itself. For each table with a FILESTREAM column, run:
    ALTER TABLE dbo.YourTable DROP COLUMN YourFilestreamColumn;
    This deletes the stored FILESTREAM data for that column. Confirm you have a backup and that the data is no longer needed.
  8. Drop any remaining objects that reference the filegroup. Check for full-text indexes, statistics, or other objects tied to the filegroup using sys.data_spaces and sys.indexes again. Drop or move each one.
  9. Drop the FILESTREAM filegroup. With no dependent objects left, run:
    ALTER DATABASE YourDatabaseName REMOVE FILEGROUP YourFilegroupName;
    If the filegroup still contains files, remove the files first with ALTER DATABASE ... REMOVE FILE YourFileName; for each file in the group, then retry the filegroup removal.
  10. Verify the change. Re-run the query from Step 1. The filegroup should no longer appear. Then run DBCC CHECKDB on the database to confirm consistency.

Common Mistakes

  • Dropping the filegroup before the partition scheme. SQL Server requires the reverse order — scheme first, then filegroup.
  • Forgetting nonclustered indexes. A nonclustered index on a partitioned table can still reference the partition scheme even after the clustered index is moved.
  • Leaving FILESTREAM columns in place. The FILESTREAM column is the most common hidden dependency; the filegroup cannot be dropped while any column uses it.
  • Skipping the backup. Dropping a FILESTREAM column deletes the stored files. There is no recycle bin.
  • Assuming DROP FILEGROUP works on a non-empty group. You must remove the files with REMOVE FILE before the filegroup can go.

Tips

  • Work top-down: partition scheme → indexes → FILESTREAM columns → files → filegroup. Each step unblocks the next.
  • Use sp_helpfilegroup 'YourFilegroupName' to list the files in the group before removing them.
  • If the database is large, move indexes during a maintenance window; rebuilding a partitioned index can take significant time and log space.
  • Script out the dependency queries from Step 1 and Step 3 and save the output — it is your checklist and your rollback reference.
  • After the drop, shrink or reorganize only if you understand the impact; do not shrink a production database casually.

Troubleshooting

Error 1720 persists after dropping the scheme. A dependent index or table remains. Re-run the Step 3 query and check sys.partitions for any partition still pointing at the filegroup.

“The filegroup cannot be removed because it is not empty.” Remove each file with ALTER DATABASE ... REMOVE FILE ..., then retry the filegroup removal.

“Cannot drop column because it is being used by a full-text index or statistics.” Drop the dependent full-text index or statistic first, then drop the column.

Permission errors. Confirm you are in db_owner and have ALTER on the database; some operations also require sysadmin.

Database is in a restoring or suspect state. Resolve the database state before attempting schema changes; run DBCC CHECKDB and consult the error log.

If that did not work, restore the backup to a test instance, reproduce the drop there, and compare the dependency output. This isolates whether a hidden object is blocking the drop without risking production.

Frequently Asked Questions

Can I force-drop a FILESTREAM filegroup with a command?

No. SQL Server does not provide a force option for error 1720. You must remove all dependent objects first.

Does dropping a FILESTREAM column delete the files on disk?

Yes. The FILESTREAM data for that column is removed. Restore from backup if you need it back.

Why does the error mention a partition scheme when I only tried to drop a filegroup?

Because the partition scheme still references the filegroup. Drop the scheme first, then the filegroup.

Can I move a partition scheme to another filegroup instead of dropping it?

You cannot move a partition scheme directly. Rebuild the dependent indexes onto a different filegroup, then drop the old scheme.

Does this work the same on Azure SQL Database?

FILESTREAM is not supported on Azure SQL Database, so this error applies to SQL Server instances and Azure SQL Managed Instance where FILESTREAM is enabled.

What if the filegroup is empty but the drop still fails?

An object still references it. Re-run the dependency queries in Steps 1 and 3; the output will name the remaining object.