Share via


SELECT Statement

Topic Last Modified: 2006-06-13

The SELECT statement is used to select items, as records returned in a recordset, from the Exchange store.

SELECT list FROM SCOPE('scope1'[,'scope2','scopeN'])[ WHERE condition [ORDER BY list [DESC|ASC]] [GROUP BY list] ]

The parameter list specifies the list of item properties to return for each record. The SELECT * Statement returns all properties defined in the expected-content-class Field of the folder.

Note

The SELECT * Statement places a large processing demand on the server that could both affect the performance of other processes and retrieve unnecessarily large amounts of data.

The following are examples of Non-Searchable Properties and will return an error in a search because they are calculated properties:

The SCOPE Element is optional. Search scopes can be shallow or hierarchical traversals of the folder, or deep traversals of the folder and its subordinate hierarchy. The default scope is a shallow traversal, allowing the FROM Predicate to be specified with just the URL of a folder. The URL must be delimited by double quotation marks.

FROM "file://./backofficestorage/domain/MBX/user/inbox/"

Scope is made up of two parts:

  • SHALLOW|DEEP|HIERARCHICAL TRAVERSAL OF
  • URL

A shallow traversal searches only the folder specified by the URL. A deep traversal searches that folder and recursively descends and searches all subfolders.

Note

You can perform a deep traversal in all stores except the public store installed for MAPI clients.

The URL specifies the location of the target folder in which to search. The ending slash is optional but recommended. The URL must be placed in double quotation marks.

The default scope, if the SCOPE Element is omitted, is a shallow traversal. If you specify the SCOPE Element but do not specify the type of traversal, the default is a deep traversal. The following snippet illustrates the use of the SCOPE Element.

SCOPE('shallow traversal of "file://./backofficestorage/domain/MBX/user/inbox/"')

The condition parameter specifies the condition that must be met for the item properties specified in list to be returned.

Example

SELECT "urn:schemas:httpmail:to", "DAV:contentclass"
FROM "file://./backofficestorage/domain/MBX/user/inbox/"
WHERE "urn:schemas:httpmail:subject" LIKE '%Exchange store%'
AND "DAV:contentclass" = 'urn:content-classes:message'
ORDER BY "urn:schemas:httpmail:date"
DESC

See Also

Other Resources

The SELECT Statement
Search Scope