Subject Re: Dynamic Variable Instantiation Within A Stored Procedure
Author Adam
--- In, "martinthrelly"
<martinthrelly@y...> wrote:
> i am building a stored procedure to handle a database search. is
> any way i can take an input search string and create an array of
> strings from it by parsing for a ' ' delimiter. then afterwards
> dynamically create a variable for each item in the string array.
> example. say my SP receives the input search parameter "bloggs joe
> brisbane australia"
> somehow i want to dynamically create a variable
> for "bloggs", "joe", "brisbane" and "australia".
> thanks

Not directly.

It is possible to split the input parameter into each word using
substring and a relatively simple while loop.

You can certainly return a record from the stored procedure for each
of these values if thats what you mean.


If you wanted to use these values in a query of some sort, you could
join to the stored procedure from another stored procedure, or use
the execute statement syntax to build a dynamic query.

But you need to give a bit more info about what you want to do with
those values.