Outputting a new line to text file + handling dates
Posted by:
AJ M
Date: January 03, 2006 12:15AM
2 questions, hopefully somebody can help me out :)
1) I'm trying to output stuff to an ascii text file. Right now i'm using: select date, open, high, low, close, volume into outfile 'c:/pf/data/myfile.txt' fields terminated by ',' lines terminated by '\n' from nox order by id DESC;
(basically it's a table that has id (primary key) date, open, high, low, close, volume)
Visually the ascii file (myfile.txt) looks fine and opens up fine in programs like Excel. However one program I need it to work in (Tradestation) absolutely refuses to see the newline character - it basically treats it like some high ascii character and reads it as date, open, high, low, close, gibberish high ascii character, date, open, high, etc.... ..... so basically 1 long string. Are there any other ways to order it to write on a new line other than using "lines terminated by '\n'?
2) I'm reading my dates in taken from a yahoo csv file. So for example, it will write 2-Jan-2006. Is there any way you can think of that SQL can read it in as a string and reformat it so it writes it like 2/1/2006 instead.
I'm stumped unfortunately on these 2 issues.