Have the sql script create the file using the "!" host command.