Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I need to automate the renaming of fields.
Table 1 and Table 2 are my fact tables. Beneath those is a transition table that would be used to rename the fields in some automated way...from the "Field" name to the "Master_Field" name. Although this is a simple example I have a project that will loop through 190 excel files and I need to rename the field names to the "Master_Field". Thanks for any help!
Table 1: | |
AgencyNum | Agency |
1 | A |
2 | B |
3 | C |
4 | D |
Table 2: | |
AgencyNum2 | Agency2 |
5 | E |
6 | F |
7 | G |
8 | H |
Meta Data - Renaming Table: | |
Field | Master_Field |
AgencyNum | AgencyNum |
Agency | Agency |
AgencyNum2 | AgencyNum |
Agency2 | Agency |
Have you read this How to Rename Fields
Thanks - I tried to do something like this but didn't work. I will see if I can make some modifications.
Ok. you can check the comment section..
you can create the external file for all your fields ($Field) and map your master field.
load
field name as new name,
field name as new name,
field name as new name,
field name as new name
resident table name;
drop main table
try in this way
I don't believe that you can rename multiple fields to the same target name. Once a field exists, you cannot rename another to have the same name. This is true for the simple rename field command and I expect that it is true for renaming with a mapping table.
And this is for a very simple reason: a RENAME outside of a LOAD will not join internal symbol tables. Would create a data mess anyway, with all those bit-stuffed pointers spread all over the place...