So, I am passing 2 arrays into a stored procedure in Sql Server 2005 as comma delimited lists. These arrays are synchrinized by their order, i.e. A1(0)
corresponds to A2(0)
, A1(1)
corresponds to A2(1)
, ... and so on.
How would I parse these arrays into 2 columns in a temp table or table variable?
EDIT: Ok, so I am passing 2 comma delimited strings into a stored procedure. I want to get these into a table with 2 columns. For instance, if
@param1 = 'field1, field2, field3'
@param2 = 'value1, value2, value3'
I want to get a table like
|----------------------------------|
| Fields | Values |
|----------------------------------|
| field1 | value1 |
| field2 | value2 |
| field3 | value3 |
|----------------------------------|
I do not know how many fiel/value pairs there may be, but in use, there really should not be more than 10 or 15.
Also, I do not necessarily need to maintain a particular order, just as long as the field/value pairs are maintained.
WE have a function that will parse one comma delimited list - could i simply copy that and create one that handles 2 strings, or parse each list separately and then join them,....