Thursday, June 24, 2010

How to Automate Simple Reporting

I was talking to my husband today and I learned how to automate a simple report having result of SQL queries as the output..Following is the way to do that.

1.)Save the query file write the querries and name it as querry.sql
2.)In the command line it is possible to dispaly the output of a sql querry in another txt file called filname.txt with the command "-o filename.txt".
3.)Convert the querry.sql file to a batch file (Batch file is a text file containing a series of commands intended to be executed by the command interpreter ) . Its a simple notepad with .bat extension.
In the batch file write the command cmdsql -q "select........" -o filename.txt
4.)There is a schedule task in Windows which helps to schedule a report. Configure the "Schedule a task" to schedule the running of this batch file at intervals decided so that the output is saved in the decided file.

No comments:

Post a Comment