October 13, 2010 at 5:26 am
Hi all, need some help.
I'm trying to split a unique set of records in an existing table to a new table with duplicate records,
i need to use the second column in the table to define how many duplicates to create of the first unique column.
I realize this sounds confusing and i've probably not explained it in the right way! so the attached is an example of what I'm trying to do.
The existing table contains millions of records and the spec_id column can range from 1 entry up to around 84 entries so one of the CuS-id's would have 84 duplicates in the new table with each of the Spec_id's.
Sorry my terminology and explanation is not great!
thanks
October 13, 2010 at 6:37 am
Try using DelimitedSplit8K function described here and the following query
SELECT test.CuS_id, split.ItemNumber, split.Item
FROM test
CROSS APPLY
(
SELECT ItemNumber, Item
FROM dbo.DelimitedSplit8k(test.Spec_id,':')
) split;
Far away is close at hand in the images of elsewhere.
Anon.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply