View Full Version : Running batch query


Sashaone
01-24-2007, 01:27 AM
Hi there,

Not sure if this the right forum....

I work for a retailer. Each retail site has an individual SQL database.
I want to extract the same information from each database, therefore I have created a batch file that connects to each database, using the IP address, and then runs the same SQL query and appends the results to a .txt file.
There is therefore one .txt file created with the information from all the retail sites.

I am then going to be importing the .txt file into an access database to do some further calculations on the data and combine with some other data.

My questions are:-

1. Is there a way of formatting the output created by the sql queries??
E.g. the output appears like below. As it is just one file I only want the headers to appear once. Also, I do not want it to return the information on how many rows have been created or the dotted lines/spaces.

2. Is it possible for the batch file to be run directly from the Microsoft Access database? Could this be automated/scheduled to automatically run once a week say??

Many thanks!!

Sasha.

pdhr_patient_seq pdhr_phar_code DeReg_Date dlup_name
-------------------- -------------------- ----------------------- ---------------------------------

(0 rows affected)
pdhr_patient_seq pdhr_phar_code DeReg_Date dlup_name
-------------------- -------------------- ----------------------- ---------------------------------

(0 rows affected)
pdhr_patient_seq pdhr_phar_code DeReg_Date dlup_name
-------------------- -------------------- ----------------------- ---------------------------------

SQL_Hell
02-06-2007, 03:15 AM
Personally I would use DTS for this task