I had a similar problem with file formats changing from one import to another so I wrote a piece of code which opened the CSV file using low level commands and read the first line. I then parsed the first line to extract the field names and compared them with a list of known field names to give the standard field name used in the system, eg for First Name or Christian Name I would use Forename. I then created a cursor in the same format as the file but using standard field names and imported the file. A scan through the cursor with SCATTER MEMVAR and INSERT INTO ... FROM MEMVAR got the file imported regardless of the format. I put a check in for rogue field names that weren't in my field name list.
John Weller 01380 723235 07976 393631 > > They also send the file in a slightly different format every time, which is really > frustrating. Column order changes, currency format changes, date format > changes......... > _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
