Why This Error Happens
Error 5509 occurs because SQL Server’s FILESTREAM filegroup treats its data file as a container directory rather than a traditional binary data file, meaning SIZE and FILEGROWTH properties are structurally incompatible with it. This typically happens when a DBA copies syntax from a standard ROWS filegroup ADD FILE statement and forgets to strip these properties out when defining the FILESTREAM container. Since FILESTREAM data is stored directly on the NTFS volume rather than inside the managed .mdf/.ndf file structure, SQL Server has no mechanism to pre-allocate size or manage growth increments for it.
Step-by-Step Resolution Guide
Step 1: Review the Current T-SQL Syntax
- Open the script that triggered the error in SQL Server Management Studio (SSMS) connected to your SQL Server 2025 instance.
- Locate the
ADD FILEclause associated with theFILESTREAM_ONfilegroup definition. - Identify instances of
SIZE =,MAXSIZE =, orFILEGROWTH =within that specific file block.
Step 2: Strip Invalid Properties from the File Definition
- Remove the
SIZE,MAXSIZE, andFILEGROWTHarguments entirely from the FILESTREAM file entry. - Ensure the syntax only retains
NAMEandFILENAME(which should point to a folder path, not a file extension like.ndf). - Example of corrected syntax:
ALTER DATABASE MyDB
ADD FILE (NAME = FileStreamData, FILENAME = 'C:\SQLData\FileStreamContainer')
TO FILEGROUP FileStreamGroup1;
Step 3: Verify the Target Directory Permissions
- Confirm the path specified in
FILENAMEdoes not already exist as a folder prior to execution; SQL Server must create this directory itself. - Check that the SQL Server service account has “Full Control” NTFS permissions on the parent directory (e.g.,
C:\SQLData\) via Windows Security > Advanced Sharing Permissions. - Re-run the corrected
ALTER DATABASEorCREATE DATABASEscript.
Step 4: Restart the SQL Server Service (If Required)
- If changes were made to the FILESTREAM configuration level (Instance level) rather than just the script, restart the SQL Server (MSSQLSERVER) service via
services.msc. - Alternatively, run
net stop MSSQLSERVERfollowed bynet start MSSQLSERVERin an elevated Command Prompt.
Alternative or Verification Steps
- Verify the fix by querying
sys.database_filesin SSMS; thesizeandgrowthcolumns for the FILESTREAM row should display as0, confirming the properties were successfully omitted. - If the container folder was partially created during a failed attempt, manually delete the specific sub-folder (not the parent drive) via File Explorer before re-attempting the
ALTER DATABASEcommand, as a pre-existing empty folder can sometimes cause secondary conflicts.