Once FILESTREAM is enabled for both the machine and the server instance, any database running on the server instance can support unstructured data by defining a filegroup with the special FILEGROUP…CONTAINS FILESTREAM clause of the CREATE DATABASE statement. For example, the statement in Example 8-1 creates a PhotoLibrary database that can store pictures using FILESTREAM. Before you can run this code, you need to create an empty folder named C:\Demo\PhotoLibrary.
Example 8-1. Creating a FILESTREAM-enabled database with FILEGROUP…CONTAINS FILESTREAM.
CREATE DATABASE PhotoLibrary ON PRIMARY (NAME = PhotoLibrary_data, FILENAME = 'C:\Demo\PhotoLibrary\PhotoLibrary_data.mdf'),
FILEGROUP FileStreamGroup1 CONTAINS ...