Article ID: 275536 - View products that this article applies to.
This article was previously published under Q275536
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 58361 (SQLBUG_70)
A query that has a LIKE clause, which contains a hyphen character "-", may run slower than expected against a non-SQL Server linked server for a remote table with a large number of rows.
You can use the hyphen character "-" as a pattern match character for ranges in SQL Server (such as [a-z]), but it is not an ANSI SQL standard pattern matching character. SQL Server incorrectly flags the hyphen character "-" as a non-ANSI pattern matching character instead of a literal hyphen ("-") and therefore prevents the criteria from being sent to the remote provider.
If the linked server provider supports it, use the OPENQUERY rowset function to force the entire query to be passed to the remote server.
Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 3 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
274799For more information, contact your primary support provider.
(http://support.microsoft.com/kb/274799/ )INF: How to Obtain Service Pack 3 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0
In this situation, the LIKE clause criteria is applied at the local SQL Server server after retrieving all rows from the remote table. So, a query like this:
is processed as follows:
Contact us for more help
Connect with Answer Desk for expert help.