David, your script works like magic
But i need to lookup with the tables to get the keys and then populate the group id's.
Vaidya, your untested theory works, You get nice single coulmn of data from a row of delimited values.
But i guess my need is something like described below
Ray your approach looks the best, but need to do a reverse vertical pivot functionality. i.e look into single rows and form multiple rows.
I guess i need to build a routine to implement this logic, unless otherwise you have a better approach.
Detail Description of Job
Based on this table
Dim_Metro_Grp
(I get my Metro_Grp_keys from here
Code: Select all
Metro_Grp_Dsply Metro_Grp_key Metro_Grp_Num_Metro
-------------------------------------------------------------------------------------------------
1030,126,432 1 3
327,529 2 2
135 3 1
158,132,126 4 3
126,158,132,130 5 4
I have to populate this table
Metro_Grp_Dtl
(combination of the Metro_Grp_keys and Metro_Key
Code: Select all
Metro_Grp_Dtl_Key Metro_Grp_key Metro_Key
-------------------------------------------------------------------------------------------------
1 1 1
2 1 2
3 1 3
4 2 4
5 2 5
6 3 7
7 4 6
By looking into the Metro Keys from
Dim_Metro
Code: Select all
Metro_id Metro_Nm Metro_Key
-------------------------------------------------------------------------------------------------
1030 abc 1
126 asd 2
432 dfg 3
327 hjd 4
592 moi 5
158 oih 6
135 rfg 7
The end result populate the
Metro_Grp_Dtl Table