Reputation: 2287
I would like to extract the file name and display it in a select when querying multiple log files with a wildcard in the from clause as in the following example:
suppose I have the following ,log files in c:\logs:
report-001.log
report-002.log
report-003.log
I would like the following pseudo-sql:
select *current_log_file_name* from 'c:\logs*.logs'
to produce the following output:
report-001.log
report-002.log
report-003.log
what function/expression can I use to accomplish this task?
Upvotes: 2
Views: 1221
Reputation: 1579
You don't need a function; almost all input formats export a field with the name or path of the log file being parsed. In most cases the field is named "LogFilename". You can then use the EXTRACT_FILENAME function to discard the path.
Upvotes: 3