Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Greetings,
I have a QVD Generator, which pulls from an excel file that is uploaded periodically. However, some of the columns may be named slightly differently sometimes. So for example, the column name could be "First Column" in some instances or sometimes it could be "First_Column". In either case only one of these columns should exist in the Excel file at any point in time, albeit under a slightly different name. So I want [First Column] or [First_Column] as [First Column]. Please let me know if this is possible.
Thanks in Advance!
Here is a way to dynamically load all the field names
You can try with the ALIAS statement. It allows you to define an automatic rename for fields with slightly deviating field names before you load them. For example,
ALIAS [First_Column] as [First Column];
will force an implicit rename in each subsequent LOAD or SELECT. Of course, the script will not automatically detect other new variations on the same field name. Artificial Intelligence is not (yet) built into the script engine .
So whenever you detect a new naming deviation, you 'll have to add it to the corresponding ALIAS statement. If you put all ALIASes in an external script and include that one in every load script, management of field naming becomes very straightforward.
Peter
I did not know about ALIAS. Thanks for introducing that Peter
My pleasure.