stored proc / mind twist

From: David Berg <dbergquist_at_bd.com>
Date: 29 Jan 2003 17:34:24 -0800
Message-ID: <1274998b.0301291734.525e556b_at_posting.google.com>


Need view or stored procedure that transforms an initial dataset and adds a new row for each string initially stored as a comma delimited array in varchar field. Ok to use functions. Return only 1 row if 0 or 1 string in array field.

Source: Table1

ID ProductName OldType


1    Everclear      textstring1
2    Doritos        textstring1,textstring2,
3    Snickers       textstring1,textstring2....textstring_N,
4    Dr Pepper      (null)

-ID is row PriKey
-ProductName is field in table.
-OldType is varchar array field to transform and create new record set
based on. It contains comma delimited text of 0 to 10 strings (last entry will be marked with comma if there is one or more string in list)

Output: View1 or StoredProc1

ID ProductName ExpandedType


1    Everclear      textstring1
2    Doritos        textstring1
2    Doritos        textstring2
3    Snickers       textstring1
3    Snickers       textstring2
       ...             ...
3    Snickers       textstringN
4    Dr. Pepper     (null)
Received on Thu Jan 30 2003 - 02:34:24 CET

Original text of this message