I currently have a code table containing a list of types (Type_ID, Description), but they are saved in another table as ID;;ID;;ID…etc
I am looking for a script that will take those ID’s and place them in a relationship table corresponding to there Type ID
For example in table A the Type_ID entries could look like:
1;;2;;4
1
3;;4
1;;2;;3;;4
I am completely stumped on how to accomplish this and any help is appreciated.
First of all, I would probably recommend going the UDF route (so that you don’t reinvent the wheel). However, given that this sounds like a one-off activity, you could just use the following:
The
@outputtable variable now contains the mapping you’re looking for. You can either copy from that to your destination at the end, or you can remove@outputfrom the query and substitute equivalent inserts directly into your relationship table.