Solved

Using a variable in full text index predicate through ADO

Posted on 2004-10-15
5
742 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
Comment Utility
Can you use a wildcard in the first parameter of CONTAINS ?  shouldn't that be a specific column ?

0
 

Author Comment

by:feti
Comment Utility
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
Comment Utility
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

772 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now