Home » RDBMS Server » Server Utilities » sqlloader - want to include part of filename in insert
sqlloader - want to include part of filename in insert [message #148023] Tue, 22 November 2005 05:43 Go to next message
davo
Messages: 2
Registered: November 2005
Junior Member
hi,
I want to write a dos script that reads through a folder, picks up the files therein, and loads the contentvia sqlloader. But, each file is different, and I want to use characters 11 and 12 of each filename to identify the company code, and insert the value into the db table along with the data within the file for each row.
Effectively I want to use filename pos 11 and 12 as a parameter or constant, that gets loaded on every row as one of the columns (company code).
does nayone have any ideas? or better still an example script to do this?
Re: sqlloader - want to include part of filename in insert [message #148127 is a reply to message #148023] Tue, 22 November 2005 20:27 Go to previous message
rleishman
Messages: 3728
Registered: October 2005
Location: Melbourne, Australia
Senior Member
I've tried the same thing in the past, but found no elegant solution.

We used a Unix 'sed' script (you could use Perl) to rewrite the file with an additional column that was derived from the filename. In Unix, we used named pipes to avoid disk and processing overheads. In Windows you would have to wait for the re-write to finish before you could load it.

_____________
Ross Leishman
Previous Topic: Triggers not imported
Next Topic: EXPORT/IMPORT
Goto Forum:
  


Current Time: Tue Jul 02 04:55:43 CDT 2024