Using SCOPE Function for File System Queries

Accessing and Changing Relational Data

Accessing and Changing Relational Data

Using SCOPE Function for File System Queries

SCOPE is specified in the FROM clause of the Indexing Service query and is used to specify the set of files that makes up a virtual table. Here is the syntax.

The table shows the syntax elements and their descriptions.

Syntax element Description
() The virtual table consists of all the files registered in the text catalog and data source for the linked server specified in the OPENQUERY() function.
DEEP TRAVERSAL OF The virtual table consists of all the files in the directory at the specified path or virtual directory as well as all the files in all subdirectories (to any level) are considered to be part of the virtual table. If neither DEEP nor SHALLOW is specified, DEEP is the default.
SHALLOW TRAVERSAL OF The virtual table consists of only of the files in the top-level directory at the specified path or virtual directory are considered to be part of the virtual table. 
physical_path This is a path to a real directory. If a real directory is specified, the filtering and indexing is done as part of the processing of the query. This can be time-consuming.
virtual_directory This is the alias (or chains of aliases) assigned to a virtual directory that has been registered in the text catalog and data source for the linked server specified in the OPENQUERY() function. In this case, the filtering and indexing probably has been done and, thus, the query is much faster than when a physical_path is specified.