Overview of the SQL Query

Overview of the SharePoint Search SQL Query

Last modified: June 25, 2010

Applies to: SharePoint Server 2010

A SharePoint Server search SQL query is similar to a standard SQL query, as shown in the following syntax.

SELECT <columns>
FROM <content source>
WHERE <conditions> 
ORDER BY <columns>

The SharePoint Server search SQL query syntax supports many options that enable more complicated queries.

Note Note

SharePoint Server search SQL queries are limited to 4096 characters to reduce the risk of potential denial-of-service attacks.

The following table describes each clause in the SELECT statement, and the features it supports.




Specifies the columns returned by the query.


Specifies the location to search.


Specifies what constitutes a matching document. This clause has many options, enabling rich control over the search conditions. For example, you can match against words, phrases, inflectional word forms, strings, numeric and bitwise values, and multivalued arrays. You can also combine matching conditions with Boolean operators.


Specifies the sort order for the results returned by the query. You can specify more than one field on which the results are sorted, and you can use ascending or descending ordering.

The following example searches for documents where the title contains "SharePoint" from the "Marketing" search scope.

SELECT rank, title, path, author from Scope() WHERE CONTAINS(title,'SharePoint') and "scope"='Marketing'
© 2015 Microsoft