crystalized
Programmer
I posted a message earlier with an awful stored procedure in it. I am sure everyone was just being polite by not telling me how bad it was. Well I have a slightly different scenario now.
To complete a search my users can enter a keyword, and make 2 selections to refine their search.
The first selection is for the location. Now the location selected can restrict the number of possible firms that match the criteria. The second selection will likewise restrict the number of possible matches. Then finally there is the keyword that I want to look in several tables for matches.
My question is how do I refine my search using the criteria I mentioned while keeping my stored procedure relatively fast.
I am considering a pattern something like this in my stored procedure
I know there are probably cursor method that would allow me to find the firms that match the location and then for each of them find the firms that suit the other criteria and finally for the filtered firms find the ones that match the keyword. But I have heard that cursors are usually quite slow which is one of the reasons I am avoiding them (the other being my lack of knowledge of how to use them).
If anyone can tell me if cursors or multiple select statements (with possible nested selects) are more efficient it would at least give me a starting point.
[sig]<p>Crystal<br><a href=mailto:crystals@genesis.sk.ca>crystals@genesis.sk.ca</a><br><a href= > </a><br>--------------------------------------------------<br>
Experience is one thing you can't get for nothing.<br>
-Oscar Wilde<br>
[/sig]
To complete a search my users can enter a keyword, and make 2 selections to refine their search.
The first selection is for the location. Now the location selected can restrict the number of possible firms that match the criteria. The second selection will likewise restrict the number of possible matches. Then finally there is the keyword that I want to look in several tables for matches.
My question is how do I refine my search using the criteria I mentioned while keeping my stored procedure relatively fast.
I am considering a pattern something like this in my stored procedure
Code:
(Select fdeFirmID from tblFirm,tblDescription
where fdeFirmID=frID and
frProv=@cProvIn and
fdeDescription like '%'+@vKeywordIn+'%')
Union
(....Next select here...)
If anyone can tell me if cursors or multiple select statements (with possible nested selects) are more efficient it would at least give me a starting point.
[sig]<p>Crystal<br><a href=mailto:crystals@genesis.sk.ca>crystals@genesis.sk.ca</a><br><a href= > </a><br>--------------------------------------------------<br>
Experience is one thing you can't get for nothing.<br>
-Oscar Wilde<br>
[/sig]