Is it possible to do a select into outfile and have the output file be a variable name? I am trying to write a cursor that will loop through a recordset, pass a variable to a procedure that exports a text file for each variable passed. Before I get to deep into this I would like to know if it is possible.
Here is my query.
select distinct student_name,student_address,student_hometown,student_state,student_honors,md_ID
from student,ht_zips,media
where student_zip = htz_zip
and htz_media_id = md_ID
into outfile 'C:/tmp/myvar.txt'
Fields Terminated by ','
Lines Terminated by '\r\n'
Also is it possible to skip fields in the output file? So if student_honors is null that it would skip that field?
I tried the IFNull, but that still prints a comma. I would like this to be skipped completely.
Our community of experts have been thoroughly vetted for their expertise and industry experience.