I must write a cron job that will query an Informix database once a day and write the results to a file. I think the best way to do this would be to call a .bat file which then queries the database. Can someone please tell me the syntax needed to connect to the DB and execute the SQL in this way.

Also, does the SQL need to be held in a separate file or can it just be written in the .bat file?