HotRod40
asked on
SQL Output
Hi,
Could anyone let me know how you would output the results of a SQL query to a .csv file.
Any help would be great,
Thanks
Could anyone let me know how you would output the results of a SQL query to a .csv file.
Any help would be great,
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
jamiguel,
its just not polite to answer a question,
when others already has given a solution
in previous comments
for the future, please,
do rather comment than answer a question,
so that the questioner can decide,
which comment helps best
meikl ;-)
its just not polite to answer a question,
when others already has given a solution
in previous comments
for the future, please,
do rather comment than answer a question,
so that the questioner can decide,
which comment helps best
meikl ;-)
sl := tstringlist.create;
try
query1.open;
while not query1.eof do
begin
for 1 := 0 to query1.fieldcount-1 do
begin
s := s + query1.fields[i].asstring;
if i < query1.fieldcount-1 then
s := s +','; //or other delimiter
end;
sl.add(s);
query1.next;
end;
sl.savetofile('Filename');
finally
sl.free;
end;
just from head, not tested
meikl ;-)