In my earlier articles, I wrote how to insert files inside the file table and this is more than enough if you maintain few files inside one filetable. But once a filetable is crowded you should maintain the files inside the folders to manage it properly. But how to create a folder inside a filetable ?
Note : I strongly recommend that you should read given below articles to have a clear understanding about FileTables.
- FileTables – Prerequisites
- FileTables – Data Definition Language (DDL)
- FileTables – Data Manipulation Language (DML)
There are two methods to create a folder inside file table. Given below are the details.
- Using SQL Server Management Studio (SSMS)
- Using T-SQL
Let me explain each method in detail.
- Using SQL Server Management Studio (SSMS)
This is the easiest way to create a folder inside filetable. In order to follow this method we need to achieve it step by step.
Step 1 :
First of all you should select the respective filetable in which you need to create a folder and right click on it and select “Explore filetable directory” as shown in the image below.
Step 2 :
Once you select “Explore filetable directory”, it will open that particular filetable directory folder. You can create folder here, just like in windows, as shown below.
- Using T-SQL
This method we usually use when we need to create a folder dynamically using T-SQL. Given below is the script.
--This script is compatible with SQL Server 2012 and above. USE SampleDB GO INSERT INTO dbo.CVBank (name,is_directory) VALUES ('New folder', 1);
[…] my earlier article, I have explained that creating a directory / sub directory in any file table is same like creating […]