PRB: Error 7321 When Executing a Select Statement to Query a Linked Server Using the Exchange OLE DB Provider (300385)
The information in this article applies to:
- Microsoft SQL Server 2000 (all editions)
This article was previously published under Q300385 SYMPTOMS
You can create a linked server from SQL Server 2000 to Microsoft Exchange Server 2000, by using the OLE DB Provider for Exchange, and executing the following script:
EXEC sp_addlinkedserver 'exchange',
'Exchange OLE DB provider',
'exoledb.DataSource.1',
'file:\\.\backofficestorage\localhost\public folders'
You should be able to view the Tables (that is, the public folders) of the linked server from the SQL Enterprise Manager. However, if you query the public folders of the linked server by using the following SELECT statement
Select Convert(nvarchar(200),"urn:schemas:contacts:sn") LastName
FROM OpenQuery(Exchange,'SELECT "urn:schemas:contacts:sn"
FROM SCOPE(".\contacts")')
you may receive the following error message:
Server: Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing a query for execution against OLE DB provider 'exoledb.DataSource.1'.
CAUSE
Exchange Server's SCOPE uses deep traversal by default, which is not supported at a MAPI public folder.
WORKAROUND
To work around this problem, do either of the following:
- Specify shallow traversal.
- Do not use the keyword SCOPE, so that shallow traversal is chosen by default.
Use any of the following statements to retrieve correct results:
SELECT Convert(nvarchar(30), "urn:schemas:contacts:sn") LastName
FROM OpenQuery(Exchange, 'SELECT "urn:schemas:contacts:sn"
FROM ".\Contact"')
SELECT Convert(nvarchar(30), "urn:schemas:contacts:sn") LastName
FROM OpenQuery(Exchange, 'SELECT "urn:schemas:contacts:sn"
FROM SCOPE(''shallow traversal of ".\Contact"'')')
Modification Type: | Major | Last Reviewed: | 10/3/2003 |
---|
Keywords: | kbBug kbprb kbProgramming KB300385 |
---|
|