I'm trying to attach a database with full text catalog and filestream, but I'm having some issues with the file stream part. Here's the SQL I'm using (according to this article, this should work):

use master

create database [Demov2] ON
(FILENAME = N'D:\Demo\Demov2.MDF'),
(FILENAME = N'D:\Demo\SQLFullTextCatalog\DemoV2_FullTextCatalog.ndf'),
(FILENAME = N'D:\Demo\LogsSQLSRA\Demov2_1.LDF'),
FILEGROUP [FileStreamGroup] contains filestream default
(Name = N'Demo_Files', FILENAME = N'D:\Demo\SQLFilestream')
for attach

This results in a error:

Msg 5120, Level 16, State 101, Line 5
Unable to open the physical file "D:\Demo\SQLFilestream". Operating system error 5: "5(Access is denied.)".
Msg 1802, Level 16, State 7, Line 5
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.

I've tried running this as sa and as a windows user but the result is always the same. I've also checked the folder permissions and I've added my windows account and SQL Server's service account with full control to the D:\Demo folder and made sure that it was propagated to its children folder:

enter image description here

Btw, I'm using an instance running this version od SQL

Microsoft SQL Server 2022 (RTM-GDR) (KB5021522) - 16.0.1050.5 (X64)   
Jan 23 2023 17:02:42   
Copyright (C) 2022 Microsoft Corporation  
Developer Edition (64-bit) on Windows 10 Enterprise 10.0 <X64> (Build 22621: ) (Hypervisor) 

It's clearly a permissions issue, but can anyone tell me what I'm missing?


1 Answer 1


Found what I was missing: the path the filesstream folder was missing the last name:

FILEGROUP [FileStreamGroup] contains filestream default
(Name = N'Demo_Files', FILENAME = N'D:\Demo\SQLFilestream\Demov2_Files')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.