How can I send data from a database to a textfile?

thanks in advance