December 25, 2008 at 11:42 am
Hi,
I am using Microsoft Indexing Service to index a set of PDF files and then running the following SQL code (within a stored procedure):
SELECT TOP 500 Results.VPath AS URL
FROM OPENROWSET('MSIDXS', 'PSAJournals';''; '',
'SELECT Rank, VPath FROM SCOPE(''deep traversal of "/journals" '') WHERE CONTAINS(''" 0') AS Results
ORDER BY [Rank] DESC
If the search terms all happen to be stop-words, SQL 2005 generates the following error message:
OLE DB provider "MSIDXS" for linked server "(null)" returned message "The query contained only ignored words. ".
I was hoping it would simply return no rows, which seems to be what happens when using full-text searches on standard tables. The error is filtering up to the web-page and causing my site to break; is there any way I can catch it within my stored procedure and simply discard it (rather like try {} and catch {} in C#)?
All answers gratefully received,
Ed Graham
December 26, 2008 at 10:00 am
SQL 2005 supports TRY and CATCH logic.
BEGIN TRY
SELECT TOP 500 Results.VPath AS URL
FROM OPENROWSET('MSIDXS', 'PSAJournals';''; '',
'SELECT Rank, VPath FROM SCOPE(''deep traversal of "/journals" '')
WHERE CONTAINS(''" 0') AS Results
ORDER BY [Rank] DESC
END TRY
BEGIN CATCH
SELECT '' as URL
WHERE 1 = 0 -- forces zero rows returned
END CATCH
__________________________________________________
Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills
December 27, 2008 at 6:00 pm
Fantastic, Bob -- that's exactly what I needed. Thanks a million!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply