Skip to content

FileTables–Inserting Directories from T-SQL

April 21, 2014

Creating a directory in a Filetable share is easy. It looks like this:

filetable_i

It’s hard to see, but this was a right click, New, Folder in the share from Windows Explorer.

However what about creating a directory from T-SQL? That’s almost as easy.

I created that folder above by running this code:

-- create a folder
INSERT  INTO dbo.Explorer
        ( name, is_directory )
VALUES  ( 'Books', 1 );

I provided a name for my folder and then a 1 for the is_directory property. Once I ran this, the folder above appeared in my share.

Note that this works for folders in the root, but not nested folders. I’ll tackle that in another post.

About these ads

From → Blog

Comments are closed.

Follow

Get every new post delivered to your Inbox.

Join 4,914 other followers

%d bloggers like this: