Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Scheduling TSQL to Output file

Author  Topic 

Rajeswari
Starting Member

20 Posts

Posted - 2001-11-29 : 02:05:24
I am scheduling the job with TSQL("Select statement"), directs the output to the text file using "Advanced" option in Job step.

Scheduling works fine, but i want to format the output.
When i open the text file, it shows step name, executed time, number of rows affected,etc. I don't want these details since I want to export the output file to the table.

sica
Posting Yak Master

143 Posts

Posted - 2001-11-29 : 04:10:58
The output file you are getting contains only these kind of information.

What do you want in the output file?

Sica

Go to Top of Page

Rajeswari
Starting Member

20 Posts

Posted - 2001-11-29 : 04:20:21
only the data, not the status of the job.

Go to Top of Page

sica
Posting Yak Master

143 Posts

Posted - 2001-11-29 : 04:50:28
If you want to output data from a certain table you should use BCP like :

EXEC('execute master..xp_cmdshell ''bcp "SELECT column_name FROM ' + @DatabaseName + '.'+ @TableName + ' where column_name=''''' + @Value + '''''" queryout '+@Path+'outputfile.txt -r\t -c -Ulogin -Ppassword -S'+ @ServerName +'''')

You have to replace the variables w/ your own or initiate them.There you have select statement as well.

Check BOL for more info.(BCP)


Go to Top of Page

Rajeswari
Starting Member

20 Posts

Posted - 2001-11-29 : 05:25:16
I already used bcp, but append option is not provided. File name is given by user, if i schedule the job to copy the data to flat file, i want to append the data. bcp overwrites the data.

Go to Top of Page

sica
Posting Yak Master

143 Posts

Posted - 2001-11-29 : 05:34:27
Use DTS then...


Sica

Go to Top of Page
   

- Advertisement -