Microsoft Knowledge Base Email Alertz

(220598) - Performing the following distributed query with SQL Server 7.0 and Index Server 2.0 OLE DB Provider SELECT a.* FROM OpenRowset('MSIDXS','Web';''; '', 'Select Directory, FileName, size, Create, Write from SCOPE() where CONTAINS(' ' Index Server...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 220598 - Last Review: October 17, 2003 - Revision: 2.1

PRB: SQL Distributed Query with MSIDXS Provider Needs Additional Quotes

This article was previously published under Q220598

SYMPTOMS

Performing the following distributed query with SQL Server 7.0 and Index Server 2.0 OLE DB Provider
SELECT a.*
FROM OpenRowset('MSIDXS','Web';''; '',  'Select Directory, FileName, size, Create, Write
 from SCOPE()
 where CONTAINS(' ' "Index Server" NEAR() "SQL Server" ' ')> 0  
 and FileName LIKE ''%.htm%'' ') as a
				
gives an error similar to the following:
Server: Msg 170, Level 15, State 1, Line 4 Line 4: Incorrect syntax near ' "Index Server" NEAR() "SQL Server" '.

CAUSE

There is an additional space character between the two single quotation mark characters inside the CONTAINS clause.

RESOLUTION

Remove any additional space characters between the two single quotation mark characters inside the CONTAINS clause. For example:
SELECT a.*
FROM OpenRowset('MSIDXS','Web';''; '',  'Select Directory, FileName, size, Create, Write
 from SCOPE()
 where CONTAINS('' "Index Server" NEAR() "SQL Server" '')> 0  
 and FileName LIKE ''%.htm%'' ') AS a
				

STATUS

This feature is by design.

MORE INFORMATION

Microsoft SQL Server version 7.0 provides the ability to perform queries against OLE DB providers, which is done by using the OpenQuery or OpenRowset Transact-SQL function or by using a query with four-part names, including a linked-server name.

You need to install Index Server 2.0 from the Windows NT 4.0 Option Pack on a SQL Server 7.0 machine in order to perform a distributed query with SQL Server 7.0 and Index Server 2.0 OLE DB Provider.

When passing the same query to MSDIXS provider outside a SQL 7.0 distributed query (for example, in an ADO application), you must use one single quotation mark instead of two single quotation marks:

Select Directory, FileName, size, Create, Write
 from SCOPE()
 where CONTAINS('"Index Server" NEAR() "SQL Server"')> 0  
 and FileName LIKE '%.htm%'
				

REFERENCES

For more details on setting up and using distributed queries, search on sp_addlinkedserver, OpenQuery, OpenRowset, and related topics in SQL 7.0 Books Online.

For a discussion on OLEDB provider configuration for distributed queries, refer to the following topic in SQL 7.0 Books Online, "Configuring OLE DB Providers for Distributed Queries."

For more information on Index Server, refer to Index Server documentation in the Windows NT 4.0 Option Pack documentation.

For additional information about how to use the "NEAR" keyword for proximity searches, please see the following article in the Microsoft Knowledge Base:
198493  (http://kbalertz.com/Feedback.aspx?kbNumber=198493/EN-US/ ) INFO: Using NEAR in SQL Full-Text and MSIDXS Distributed Queries

APPLIES TO
  • Microsoft SQL Server 7.0 Standard Edition
  • Microsoft OLE DB Provider for Index Server 2.0
Keywords: 
kbdatabase kbprb KB220598
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate