The system-defined FileTable schema includes a non-clustered primary key and two non-clustered unique constraiants. Any of these will uniquely identify a file table row:
- primary key constraint (non-clustered): path_locator (hierarchyid)
- unique constraint (non-clustered): stream_id (uniqueidentifier)
- unique constraint (non-clustered): parent_path_locator (hierarchyid), name (nvarchar(255))
The main advantage of storing stream_id
in your support table for the file table row locator (and perhaps foreign key) is that it's narrowest of these candidate keys. I suggest stream_id
for most use cases.