SQL Server Error 1726: FILESTREAM Filegroup Fix
In this article
SQL Server error 1726 ("Cannot add FILESTREAM filegroup or partition scheme") means you tried to add a FILESTREAM filegroup to a database that was not created with FILESTREAM enabled, or you tried to add a partition scheme to a FILESTREAM filegroup, which is not allowed. The fix is to enable FILESTREAM at the instance level, then either create a new database with a FILESTREAM filegroup or add one to an existing database that was created with FILESTREAM support. You cannot enable FILESTREAM on a database that was created without it, and you cannot partition a FILESTREAM filegroup.
What You'll Need
- SQL Server Management Studio (SSMS) or sqlcmd connected to the instance with sysadmin or db_owner rights.
- Permission to change SQL Server configuration settings (sp_configure) and restart the SQL Server service.
- If the database already exists and lacks FILESTREAM, a plan to create a new database and migrate data, because FILESTREAM cannot be added to an existing non-FILESTREAM database.
- Access to the Windows registry or SQL Server Configuration Manager to enable FILESTREAM at the OS level if it is not already on.
Step-by-Step
- Confirm the exact error context. Run the failing statement in SSMS and note whether it is an ALTER DATABASE ... ADD FILEGROUP ... CONTAINS FILESTREAM, or a CREATE PARTITION SCHEME that references a FILESTREAM filegroup. The error number 1726 is the same, but the cause differs: the first is a database-level FILESTREAM setting problem; the second is an unsupported operation (partition schemes cannot use FILESTREAM filegroups).
- Check instance-level FILESTREAM configuration. In SSMS, right-click the server, choose Properties, then the Advanced page, and look at the Filestream Access Level value. Alternatively run
EXEC sp_configure 'filestream access level';. If the run_value is 0, FILESTREAM is disabled at the instance level. Note that menu labels can differ slightly by SSMS version. - Enable FILESTREAM at the instance level. Run
EXEC sp_configure 'filestream access level', 2; RECONFIGURE;(2 enables full access; 1 enables T-SQL access only). Then restart the SQL Server service (SQL Server Configuration Manager > SQL Server Services > right-click the instance > Restart). A restart is required for the change to take effect. - Enable FILESTREAM at the OS level if needed. In SQL Server Configuration Manager, open the instance's properties, go to the FILESTREAM tab, and tick the boxes for enabling FILESTREAM for Transact-SQL access and, if you need file I/O streaming, for file I/O streaming access. Set a Windows share name if you enable file I/O. Apply and restart the service if prompted.
- Check the database's FILESTREAM setting. Run
SELECT name, is_filestream_enabled FROM sys.databases WHERE name = 'YourDb';. If it returns 0, the database was not created with FILESTREAM and you cannot add a FILESTREAM filegroup to it. The only supported path is to create a new database with a FILESTREAM filegroup and migrate your data. - Create a new FILESTREAM-enabled database (if needed). Use
CREATE DATABASE YourDb ON PRIMARY (NAME = N'YourDb', FILENAME = N'C:\Data\YourDb.mdf'), FILEGROUP FileStreamGroup CONTAINS FILESTREAM (NAME = N'YourDb_FileStream', FILENAME = N'C:\Data\YourDb_FS') LOG ON (NAME = N'YourDb_log', FILENAME = N'C:\Data\YourDb_log.ldf');. The FILESTREAM directory must not already exist; SQL Server creates it. - If the database is already FILESTREAM-enabled, add the filegroup correctly. Run
ALTER DATABASE YourDb ADD FILEGROUP FileStreamGroup CONTAINS FILESTREAM;thenALTER DATABASE YourDb ADD FILE (NAME = N'YourDb_FileStream', FILENAME = N'C:\Data\YourDb_FS') TO FILEGROUP FileStreamGroup;. The directory must not exist beforehand. - Do not attempt to add a partition scheme to a FILESTREAM filegroup. Partition schemes are only supported on regular filegroups. If your goal is partitioning, create a separate non-FILESTREAM filegroup and partition scheme for the relational columns, and keep the FILESTREAM column in its own filegroup. FILESTREAM data itself cannot be partitioned.
- Verify. Run
SELECT name, type_desc, is_filestream FROM sys.filegroups WHERE database_id = DB_ID('YourDb');and confirm the FILESTREAM filegroup appears with is_filestream = 1. Then create a test table with a VARBINARY(MAX) FILESTREAM column and insert a small row to confirm it works.
Common Mistakes
- Trying to add a FILESTREAM filegroup to a database created without FILESTREAM. The is_filestream_enabled flag is fixed at creation; there is no ALTER to turn it on.
- Forgetting to restart the SQL Server service after sp_configure. The setting will not take effect until the service restarts.
- Pointing the FILESTREAM file at a directory that already exists. SQL Server requires the directory to be absent and will create it.
- Using a network share or a path the SQL Server service account cannot access. The service account needs full control of the FILESTREAM directory.
- Assuming partition schemes can include FILESTREAM filegroups. They cannot; the error is telling you the operation is unsupported, not that a setting is missing.
- Enabling FILESTREAM at the instance level but not at the OS level (or vice versa), which leaves the feature partially configured.
Tips
- Decide on FILESTREAM before you create the database. Retrofitting means a new database and a data migration.
- Use a dedicated filegroup name such as FileStreamGroup so it is obvious in scripts and backups.
- Keep FILESTREAM directories on a volume sized for large binary objects, separate from the data and log files if possible.
- Test the configuration on a non-production instance first, especially the service restart.
- Record the sp_configure and Configuration Manager changes so the build is repeatable on other servers.
Troubleshooting
If sp_configure still shows 0 after RECONFIGURE, check that you ran it in the correct instance and that you have ALTER SETTINGS permission (sysadmin or serveradmin). If the service will not restart, check the SQL Server error log for FILESTREAM-related startup errors; a bad directory path or permissions problem often appears there. If the ALTER DATABASE ADD FILE fails with an access error, confirm the SQL Server service account has full control of the parent folder and that the target directory does not exist. If the database still reports is_filestream_enabled = 0, you are on a database that predates FILESTREAM; create a new database and migrate. If the error occurs on a partition scheme statement, remove the FILESTREAM filegroup from the scheme and partition only the non-FILESTREAM filegroup. If nothing works, capture the full error message and the output of SELECT @@VERSION; and EXEC sp_configure 'filestream access level'; before escalating.
Frequently Asked Questions
Can I enable FILESTREAM on an existing database?
No. The FILESTREAM setting is fixed when the database is created. You must create a new database with a FILESTREAM filegroup and migrate your data.
Why can't I add a partition scheme to a FILESTREAM filegroup?
Partition schemes are not supported on FILESTREAM filegroups. Keep FILESTREAM data in its own filegroup and partition only regular filegroups.
Do I need to restart SQL Server after enabling FILESTREAM?
Yes. Changing the filestream access level with sp_configure requires a service restart for the new value to take effect.
What access level should I set?
Use 2 for full access (T-SQL and file I/O streaming) or 1 for T-SQL access only. Choose based on whether your application needs Win32 streaming.
Does the FILESTREAM directory need to exist before I add the file?
No. The directory must not exist; SQL Server creates it. Pointing at an existing directory causes an error.
Is error 1726 always about FILESTREAM?
In this context, yes: it appears when adding a FILESTREAM filegroup to a non-FILESTREAM database or when a partition scheme references a FILESTREAM filegroup.