Solved

Using a variable in full text index predicate through ADO

Posted on 2004-10-15
5
744 Views
Last Modified: 2012-08-14
I need to run full text indexing on a table joined with another table using a variable as the full text predicate.

First I tried to run this query directly from the web site:

SELECT styles.style_id, styles.styleName, styles.itemNumber, styles.detailName, styles.shortDesc, styles.longDesc, styles.keywords, MIN(offerPrice.price) AS lprice, MAX(offerPrice.price) AS hprice
FROM styles INNER JOIN offerPrice ON styles.style_id = offerPrice.style_id
WHERE (offerPrice.defaultFlag = '1') AND CONTAINS(styles.*, '" & strSiteSearch & "')
GROUP BY styles.style_id, styles.styleName, styles.itemNumber, styles.detailName, styles.shortDesc, styles.longDesc, styles.keywords
ORDER BY '" & sort & "'

I get this error:
ASP Error occurred 10/15/2004 10:16:49 AM in Microsoft OLE DB Provider for SQL Server
Error number: -2147217887 (0x80040E21)
File: /search.htm, line 174
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

To get around that I thought I could just put it into a stored procedure. the stored procedure looks like this:
CREATE PROCEDURE dbo.siteSearch
@strSearch AS varchar(250)
AS
SELECT styles.style_id, styles.styleName, styles.itemNumber, styles.detailName, styles.shortDesc, styles.longDesc, styles.keywords, MIN(offerPrice.price) AS lprice, MAX(offerPrice.price) AS hprice
FROM styles INNER JOIN offerPrice ON styles.style_id = offerPrice.style_id
WHERE (offerPrice.defaultFlag = '1') AND CONTAINS(styles.*, @strSearch)
GROUP BY styles.style_id, styles.styleName, styles.itemNumber, styles.detailName, styles.shortDesc, styles.longDesc, styles.keywords
ORDER BY styleName
GO

I execute this stored procedure from the web site like this:
Set rsTHUMBS = Server.CreateObject("ADODB.Recordset")
cmdTemp.CommandText = "EXECUTE siteSearch '" & strSiteSearch & "'"
rsTHUMBS.Open cmdTemp, , 1, 3
If NOT rsTHUMBS.EOF Then ...

That give me this error:
ASP Error occurred 10/15/2004 10:23:45 AM in Microsoft OLE DB Provider for SQL Server
Error number: -2147217900 (0x80040E14)
File: /search.htm, line 174
A variable cannot be used to specify a search condition in a fulltext predicate when accessed through a cursor.

Any work arounds/suggestions? Is there a way to accomplish what I am trying to do?

Thank you very much for your help.
0
Comment
Question by:feti
  • 2
5 Comments
 
LVL 6

Expert Comment

by:JaffaKREE
ID: 12321963
Can you use a wildcard in the first parameter of CONTAINS ?  shouldn't that be a specific column ?

0
 

Author Comment

by:feti
ID: 12321982
I have run this query and stored procedure without error in Enterprise Manager. It's only through ADO that I get the error. The wildcard simply says to check all of the fields in the catalog.
0
 
LVL 6

Accepted Solution

by:
JaffaKREE earned 200 total points
ID: 12322088
I get the feeling this is one of those "not supported" things.   I'm out of my league here, and this is all I found (google cache link):

http://64.233.167.104/search?q=cache:a1OqLW0qSZIJ:65.61.175.198/t883114.html+%22sql+server%22+%22A+variable+cannot+be+used+to+specify+a+search+condition+%22&hl=en
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question