Enable the Prerequisites for FileTable
Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).
Describes how to enable the prerequisites for creating and using FileTables.
I want to …
To enable the prerequisites for creating and using FileTables, enable the following items:
At the instance level:
At the database level:
FileTables extend the capabilities of the FILESTREAM feature of SQL Server. Therefore you have to enable FILESTREAM for file I/O access at the Windows level and on the instance of SQL Server before you can create and use FileTables.
How To: Enable FILESTREAM at the Instance Level
For information about how to enable FILESTREAM, see Enable and Configure FILESTREAM.
When you call sp_configure to enable FILESTREAM at the instance level, you have to set the filestream_access_level option to 2. For more information, see filestream access level Server Configuration Option.
How To: Allow FILESTREAM through the Firewall
FileTables let Windows applications obtain a Windows file handle to FILESTREAM data without requiring a transaction. To allow this non-transactional access to files stored in SQL Server, you have to specify the desired level of non-transactional access at the database level for each database that will contain FileTables.
How To: Check Whether Non-Transactional Access Is Enabled on Databases
Query the catalog view sys.database_filestream_options (Transact-SQL) and check the non_transacted_access and non_transacted_access_desc columns.
SELECT DB_NAME(database_id), non_transacted_access, non_transacted_access_desc FROM sys.database_filestream_options; GO
How To: Enable Non-Transactional Access at the Database Level
The available levels of non-transactional access are FULL, READ_ONLY, and OFF.
When you enable non-transactional access to files at the database level, you can optionally provide a directory name at the same time by using the DIRECTORY_NAME option. If you do not provide a directory name when you enable non-transactional access, then you have to provide it later before you can create FileTables in the database.
In the FileTable folder hierarchy, this database-level directory becomes the child of the share name specified for FILESTREAM at the instance level, and the parent of the FileTables created in the database. For more information, see Work with Directories and Paths in FileTables.
How To: Specify a Directory for FileTables at the Database Level
The name that you specify must be unique across the instance for database-level directories.
How to: View Existing Directory Names for the Instance
To view the list of existing directory names for the instance, query the catalog view sys.database_filestream_options (Transact-SQL) and check the filestream_database_directory_name column.
SELECT DB_NAME ( database_id ), directory_name FROM sys.database_filestream_options; GO
Requirements and Restrictions for the Database-Level Directory
Setting the DIRECTORY_NAME is optional when you call CREATE DATABASE or ALTER DATABASE. If you do not specify a value for DIRECTORY_NAME, then the directory name remains null. However you cannot create FileTables in the database until you specify a value for DIRECTORY_NAME at the database level.
The directory name that you provide must comply with the requirements of the file system for a valid directory name.
When the database contains FileTables, you cannot set the DIRECTORY_NAME back to a null value.
When you attach or restore a database, the operation fails if the new database has a value for DIRECTORY_NAME that already exists in the target instance. Specify a unique value for DIRECTORY_NAME when you call CREATE DATABASE FOR ATTACH or RESTORE DATABASE.
When you upgrade an existing database to SQL Server 2016, the value of DIRECTORY_NAME is null.
When you enable or disable non-transactional access at the database level, the operation does not check whether the directory name has been specified or whether it is unique.
When you drop a database that was enabled for FileTables, the database-level directory and all the directory stuctures of all the FileTables under it are removed.