Articles → SQL SERVER → Filetables In The SQL Server

Filetables In The SQL Server






Purpose






  1. FileStream
  2. File and folder information
  3. File attributes

How To Create A Filetable?




CREATE TABLE <File_Table_Name> AS FileTable  
    WITH (   
          FileTable_Directory = '<Directory_Name>',  
          FileTable_Collate_Filename = database_default  
         );   




  1. Directory name is the root directory of all the files and folders stored in the FileTable
  2. The directory name must be unique for all filetables for a database
  3. If the directory name is blank then the name of the filetable is used as the directory name
  4. The database_default is the name of the collation to be applied on the name column

Restriction On Creating The Filetable


  1. You cannot alter an existing table to convert it into a FileTable
  2. You cannot create a FileTable in the tempdb database or in any of the other system databases
  3. You cannot create a FileTable as a temporary table

How To Change The Directory Of The Filetable?


ALTER TABLE filetable_name  
    SET ( FILETABLE_DIRECTORY = N'<directory_name>' );  





Posted By  -  Karan Gupta
 
Posted On  -  Monday, February 6, 2023

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250