SQL Server Performance Forum – Threads Archive
Ned Help – SP normalizing dataWe have a stored proc that runs nightly and takes 90 minutes to run.
The record count in the source table is about 630,000 rows, and the destination table ends up with 765,000 rows. It basically normalizes data from one table into another. Because we can’t track date changes in the source table, we have to repopulate the 2nd table nightly. One record of source data looks like this:
Song_ID Terr Catalog Percent Fix Admin
1204 1 GC62755GC61378 500000500000 ABCD|EABCD|E P10336|P1314P10336|P1314 The normalized data (4 records) looks like this:
Song Catalog Admin Fix Terr Percent
1204 GC61378 P10336 ABCD 1 500000
1204 GC61378 P1314 E 1 500000
1204 GC62755 P10336 ABCD 1 500000
1204 GC62755 P1314 E 1 500000 Is there a way that jumps out to parse this "multi-valued" data easier than using a bunch of string functions on each record (eg. charindex, substring,len)?
Is there a set amount of "extra" value that can be in those rows using the "" delimiter? For example, do you have a max of 2 as in your example? MeanOldDBA
[email protected] When life gives you a lemon, fire the DBA.