I have a simple script that creates subdirectory in FileTable:
INSERT INTO MyFiles (name, is_directory)
VALUES ('SomeFolder', 1, 0)
It works corrrect and if I run it SqlServer creates subdirectory 'SomeFolder'. But if I try to create nested subfolder I face with an error:
INSERT INTO MyFiles (name, is_directory)
VALUES ('FirstLevel\SecondLevel', 1)
Error message is: An invalid filename, 'FirstLevel\SecondLevel', caused a FileTable check constraint error. Use a valid Windows filename
.
As I know I must add parent_path_locator column for parent folder, for instance:
INSERT INTO MyFiles (name, is_directory, parent_path_locator)
VALUES ('SecondLevel', 1, pathLocatorForFirstLevel)
But I have not pathLocatorForFirstLevel
cause FirstLevel
is not created yet. Maybe anyone know how to create subfolder with arbitrary name?