February 15, 2007 at 8:50 am
I have a Stored procedure which has a input parameter that accepts a string with mulpile words('alaska,newyok,ohio'). It can have N number of words.
IN the procedure I need to check a column that match all these values.
Say If i have coulmn states in the database as 'alaska,michigan,ohio,newyork' and 'alaska,newyok,ohio'
When I search with the above input string'alaska,newyok,ohio') My Storedprocedure has to return both the above strings.
If the input string is ''alaska,michigan,ohio,newyork' it should return only the first string.
I am not searching exactly with the input string. I will split it into indivudual words and i iwll check states column which has all that words.
How can i implement this.
Thanks.
February 15, 2007 at 11:10 am
search for the Split function in the scripts section of SSC; there are several that will do this.
searching for Split in the forums will get you loads of ewxamples as well:
Lowell
February 16, 2007 at 7:33 am
I normally pass the values to a string to table function (I can send you one if you need it just message me). This creates a temp table with each value now being a row. Then do an innner join (or whatever) to your other tables to limit the resultset, or get other values ...
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply