I've been trying to work out how to accomplish this, but I think I just don't have the skills to know what to look for in the first place. I'm working with an existing system, and I cannot alter the database schema, nor can I dictate how the users enter data. I have to work with what we have.
Currently, our user is putting stats data into one text field in a table. They are using a standard format of one stat per line, with text qualifiers to 'delimit' the details of the stat. i.e.
<Category> - D:<Description> Q:<Quanitity> V:<Value>
<Category> - D:<Description> Q:<Quanitity> V:<Value>
(there aren't any <> brackets in the actual data... I was just using them to show where details go.)
In the above example, the two stats are held in one text field record... and there are many of these 'stats' records in the table.
Edit: I am using MS SQL Server 2005 I need to create a report for sums of quanitites/values per description.
I have implemented a split user function that I can use on one record to split each line into individual records... but that is as far as I've managed to get.
I need to 'Select Stats from StatsTable', then loop through each stats record, split it up into individual lines, then extract the category, description, quantity and value from each split line, then return all of the results in one table.
I've managed to patch together a nested cursor... It looks like it works.