Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to save data in a file
Message
 
To
17/05/2005 13:29:28
Keith Payne
Technical Marketing Solutions
Florida, United States
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
01014572
Message ID:
01015487
Views:
20
Keith,

There are two ways to do this. You will need a VBscript or Jscript to make this go, and probably a temp table somewhere, I will just give you the overview of the process. Both processed depend on the SQl Server Agent (under the management section of your SQL server in the enterprise manager). The first thing is to create a new job, a simple name will do (no spaces or punctuation, please). Once you have filled the General Tab, click on the Steps tab, in this case you will have one step and click new, name the step (most anything will be fine here, it is used for tracing and logging) - look at the type and here is where we diverge:

1.Operating System Command (cmdExe): This depends on your script being outside the server. This type tends to be messy if you are deploying the database on multiple servers, and security is at risk (by default I restrict access to the cmdexec in case the SQL server is compromised). Basically this will call a script outside the server.

2.ActiveX script, very much like the above, but the script is actually stored in the server. You just write the script in the area provided.

Save the job.

To execute the job you can schedule it to run regularly, or use the sp_start_job:

sp_start_job [@job_name =] 'job_name' | [@job_id =] job_id
[,[@error_flag =] error_flag]
[,[@server_name =] 'server_name']
[,[@step_name =] 'step_name']
[,[@output_flag =] output_flag]

The function of the script should be to pull the data into a dataset and export it to a CSV file, and you are done. I use this for distributing/exporting data via FTP (don't ask, those are the requirements) and works fine by combining SQL jobs and scripts.

Hope this helps,

-R!

-R!
Ricardo A. Parodi
eSolar, Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform