title: How to attach an SQL Server database containing File Stream from one server to another server
body: <p>I inherited a database, there is no backup.</p>
  <p>This database was created on SQL Server 2017 (v14) and the server is no longer available.</p>
  <p>I have the <code>.MDF</code>, <code>.LDF</code> and the <code>filestream.hdr</code> files.</p>
  <p>Now I want to attach this database to SQL Server 2017.</p>
  <p>As you guess it, the attached process fails.</p>
  <p>If I try to attached from Management Studio, I get an error that the file stream folder cannot be located.</p>
  <p>However, if I point to the folder in script, I get File Activation Error.</p>
  <p>There are two folders in the MyDB_Filestream folder but both are empty.
  <code>$FSGC</code> and <code>$FSLOG</code></p>
  <p>What am I missing?</p>
  <pre><code>USE MASTER;
  GO
  
   CREATE DATABASE [MyDB] ON 
   ( FILENAME = N'D:\MSSQL14.InstanceName\MSSQL\DATA\MyDB.mdf' ),
   ( FILENAME = N'L:\MSSQL14.InstanceName\MSSQL\Log\MyDB_log.ldf' ),
      
   FILEGROUP [MyFileStream] CONTAINS FILESTREAM DEFAULT 
      
   ( NAME = N'MyFileStream', FILENAME = N'D:\MSSQL14.InstanceName\MSSQL\DATA\MyDB_FileStream' )
      
   FOR ATTACH
      
   GO
  </code></pre>