Friday, March 30, 2012

Saving results of job to a text file

OK. I figured out a way how to do this and in case anyone
else wants to do it...
Call osql using Operating System Command from the job step.
osql -Ssrever -Uuser -Ppassword -Q"DB.dbo.stored proc"
I'd still be interested in know how other people do it.
Still need to play around a bit with the file format.
Amelia.

>--Original Message--
>Using the SQLServer job scheduler, just wondering if it
is
>possible to call a stored proc in a job step using Type
>Transact-SQL and then save the results out to a text file?
>At the moment, I am using Operating System Command Type
to
>call a command file which calls a windows script file
>using javascript to call the stored proc using osql and
>then specifiying the file name for output here.
>This must be a common thing in Prod Support environments
>to schedule daily jobs to run taht produce result files
>saved somewhere. Is there a simpler way?
>Thanks for any help.
>.
>
Another way is to use the T-SQL job type step. When viewing
the job step properties, click the advanced tab. From there,
you can specify an output file for the results of the t-sql
command for the job step.
-Sue
On Tue, 29 Jun 2004 18:28:42 -0700,
<anonymous@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>OK. I figured out a way how to do this and in case anyone
>else wants to do it...
>Call osql using Operating System Command from the job step.
>osql -Ssrever -Uuser -Ppassword -Q"DB.dbo.stored proc"
>I'd still be interested in know how other people do it.
>Still need to play around a bit with the file format.
>Amelia.
>is
>to
|||Thanks Sue. I didn't know this method either.
:0)
Amelia
>--Original Message--
>Another way is to use the T-SQL job type step. When
viewing
>the job step properties, click the advanced tab. From
there,
>you can specify an output file for the results of the t-
sql[vbcol=seagreen]
>command for the job step.
>-Sue
>On Tue, 29 Jun 2004 18:28:42 -0700,
><anonymous@.discussions.microsoft.com> wrote:
anyone[vbcol=seagreen]
step.[vbcol=seagreen]
file?[vbcol=seagreen]
environments
>.
>
|||This is exactly what I was after. I feel so silly that I
did not see this before.
Thanks again.
Amelia
[vbcol=seagreen]
>--Original Message--
>Thanks Sue. I didn't know this method either.
>:0)
>Amelia
>viewing
>there,
>sql
>anyone
>step.
it[vbcol=seagreen]
Type[vbcol=seagreen]
>file?
Type[vbcol=seagreen]
and[vbcol=seagreen]
>environments
files
>.
>
|||You have plenty of company - a lot of people miss that this
functionality is available.
Glad it helped -
-Sue
On Sun, 4 Jul 2004 21:02:26 -0700, "Amelia"
<anonymous@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>This is exactly what I was after. I feel so silly that I
>did not see this before.
>Thanks again.
>Amelia
>it
>Type
>Type
>and
>files

No comments:

Post a Comment