http://www.sqlservercentral.com/blogs/steve_jones/2014/04/21/filetablesinserting-directories-from-t-sql/

Printed 2014/12/18 07:59AM

FileTables–Inserting Directories from T-SQL

By Steve Jones, 2014/04/21

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.


Filed under: Blog Tagged: Filetable, sql server, syndicated, T-SQL
Copyright © 2002-2014 Simple Talk Publishing. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.