Troubleshooting Guide: SQL Server Error 5505
Why This Error Happens
This error occurs when you attempt to create or alter a table containing FILESTREAM columns without defining a proper unique row identifier. SQL Server requires every FILESTREAM-enabled table to have a column with the ROWGUIDCOL property that is both UNIQUE and NOT NULL, because this GUID is used internally to map table rows to the corresponding files on the filesystem. Without this constraint, SQL Server has no reliable way to track which filesystem object belongs to which row, so the DDL operation is rejected.
Step-by-Step Resolution Guide
Step 1: Verify the Table Definition
- Open SQL Server Management Studio (SSMS) and script out the existing
CREATE TABLEstatement. - Check whether a
uniqueidentifiercolumn exists in the table. - Confirm whether that column currently has the
ROWGUIDCOLproperty and aUNIQUEconstraint applied.
Step 2: Add the Required ROWGUIDCOL Column
- If the column is missing, add it using the following syntax:
ALTER TABLE YourTable ADD RowGuidCol UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL UNIQUE DEFAULT NEWID();- If the column already exists but lacks the property, drop and recreate the column, or create a new table with the corrected schema and migrate data using
INSERT INTO ... SELECT.
Step 3: Apply the Correct Constraints
- Ensure the column enforces uniqueness via a
UNIQUEorPRIMARY KEYconstraint: ALTER TABLE YourTable ADD CONSTRAINT UQ_RowGuidCol UNIQUE (RowGuidCol);- Make sure the column is explicitly set to
NOT NULL(FILESTREAM will reject nullable GUID columns).
Step 4: Re-run the FILESTREAM Table Creation
- Re-execute your original
CREATE TABLEorALTER TABLEstatement that adds the FILESTREAM column. - Confirm the FILESTREAM filegroup is correctly referenced in the
TEXTIMAGE_ONclause. - Example:
CREATE TABLE Docs (Id INT PRIMARY KEY, RowGuidCol UNIQUEIDENTIFIER ROWGUIDCOL NOT NULL UNIQUE DEFAULT NEWID(), FileData VARBINARY(MAX) FILESTREAM) FILESTREAM_ON FilestreamGroup1;
Step 5: Restart the SQL Server Service (If Needed)
- Open Services.msc on Windows Server 2025 / Windows 11.
- Locate SQL Server (MSSQLSERVER) or your named instance.
- Restart the service to ensure FILESTREAM filegroup settings are fully reloaded.
Alternative or Verification Steps
- Run
sp_help 'YourTable'in SSMS to confirm theROWGUIDCOLproperty and constraints are correctly applied before retrying FILESTREAM operations. - If the error persists, verify FILESTREAM is enabled at the instance level via SQL Server Configuration Manager > SQL Server Services > Properties > FILESTREAM tab, and ensure the Windows service account has read/write access to the FILESTREAM data directory.