Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
andywakeling
Starting Member
3 Posts |
Posted - 2005-02-07 : 07:53:42
|
| I am executing a stored procedure that uses a cursor to do a CONTAINS search for each record and to produce a result set from that for output. The trouble is that if a good old "ignored words" error occurs for one of the records the procedure stops running. I need this to carry on running regardless of this as the only reason an error would occur would be due to bad user input which does not bother me and can therefore be "ignored". I have followed the advice in the KB article at http://support.microsoft.com/default.aspx?scid=kb;en-us;246800 for formatting input for CONTAINS searches but there is always some nasty ASCII/UNICODE character that slips through.Is there a method to isolate the full-text search (or any part of the procedure for that matter) and to guarantee that my stored procedure will run to the end of the cursor?The code is something like this:DECLARE TestCursor CURSOR FOR /*WHATEVER*/OPEN TestCursorWHILE (1 = 1)BEGINFETCH NEXT FROM TestCursor INTO @SearchTextSET @SearchText = FormatSearchText(@SearchText)/* This is a UDF with output as per KB article as mentioned. If anything goes wrong this returns '' as I am not bothered if it cannot resolve input but note: This can still output junk that can break the CONTAINS search. */INSERT INTO #TEMPTABLE SELECT /*WHATEVER FROM WHEREVER*/ WHERE CONTAINS(/*SEARCHFIELD*/, @SearchText)/*When run in QA, if this query causes an ignored-word error the SP stops dead. I need it to carry on to the end of the cursor.*/END, CLOSE, DEALLOCATE etc.SELECT * FROM #TEMPTABLE /* Output of entire cursor */Any help would be much appreciated. |
|
|
|
|
|