Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

outputting query to a txt file

Status
Not open for further replies.

Bealy

IS-IT--Management
Apr 20, 2002
68
AU
I need to run a query twice a day and want to schedule this. Can it be done?

It is a reject table I need to check.
I also want to output the query to a file so i can easily check if it works.

Any ideas?

Bealy
 
Create a DTS package to run the query and output it to a file, then schedule the DTS package to run at whatever interval you like.

Do you need a hand creating the DTS package?

--Angel [rainbow]
-----------------------------------
Every time I lose my mind, I wonder
if it's really worth finding.
 
Easy. Use Enterprise Manager. Drill down to SQL Server Agent. Expand that. Find Jobs. Right click, select New Job. Give the job a name. Go to Steps tab. Click New Step. Fill in the blanks. Select the Advanced tab. That's where you tell it where to output the information. Make sure you give it the FULL file name (\\<path>\myfile.txt). Select Apply. Go to the Schedule tab. Schedule when you want the job to run. Click on Apply, OK.

That's basically all you need to do.

One point, if you type in the commands in the job step window, it will only take a certain amount of code lines. I suggest creating a stored procedure (refer to the Books OnLine for CREATE PROCEDURE) and run that command via the job step.

-SQLBill
 
Angel and SQLBill, Thankyou. That is exactly what I am looking for. Angel, I will see how I go with Bills advice otherwise I might ask for a clue on how to create DTS packages.
I really need to go to SQL2000 training.

Bealy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top