Groups | Blog | Home
all groups > sql server mseq > march 2005 >

sql server mseq : Need help with stored procedure.


Vanessa Lee
3/13/2005 7:29:30 PM
Hi,
I am using SQL Server 2000 on Windows 2000 server. Here is my problem:

@String = 'word1word2word3word4word5' - This value is passed to Stored
Procedure from the script.

Column1 in a table1 has many rows with "words" . One row in this column1
will have 'word3'. Notice that this 'word3' is contained in the @String.

I need to write a stored procedure SELECT statement that will return all
(Select *) values from all columns corresponding to a row containing
'word3'. (this 'word3' must be found in @String). 'word3' is the entire
value of the column. Somehow the search will have to be done on @String to
see if there is a match, and if there is a match, return values of all
columns corresponding to this row where the match is found.

It will have to be something like:

SELECT * FROM table1 WHERE @String has 'word3' in it.

I need help with the statement after the WHERE command.

Thank you for your help.
Vanessa

Steve Kass
3/14/2005 1:49:23 PM
Vanessa,

Here are some links you might find useful - the idea in them is to
parse the @String value into a table you can then join against:

http://www.algonet.se/~sommar/examples_of_lists.html
<http://www.algonet.se/%7Esommar/examples_of_lists.html>
http://www.users.drew.edu/skass/*sql*/ListToTableProc.*sql*.txt
<http://www.users.drew.edu/skass/sql/ListToTableProc.sql.txt>

Steve Kass
Drew University

[quoted text, click to view]
AddThis Social Bookmark Button