Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can SQL Server Agent Job output file messages be suppressed?

638 views
Skip to first unread message

jps

unread,
Jul 9, 2002, 3:14:36 PM7/9/02
to
When defining SQL Server Agent Jobs, one has the option of
directing the results of a Job step to an output file. If
the execution was successful, this file will precede the
results of the Job step with the message:

Job '<job name>' : Step <step number>, '<step name>' :
Began Executing <date time>

Is it possible to suppress this message? Perusing the msdb
stored procedure sp_start_job, one finds:

1) An input parameter

@output_flag INT = 1 -- Set to 0 to
-- suppress the success message

2) A conditional statement relating to the above

IF ((@retval = 0) AND (@output_flag = 1))
RAISERROR(14243, 0, 1, @job_name)

However, error message 14243 is 'Job '%s' started
successfully', not the message that appears at the
beginning of a Job Step output file. Therefore, is one
correct in presuming that passing the @output_flag
parameter as 0 to sp_start_job will not suppress the first
message line in the output file? If so, is there some way
of accomplishing this objective?

Thanks for any help.
- jps

Michiel Wories [MS]

unread,
Jul 9, 2002, 4:00:47 PM7/9/02
to
This flag is unrelated to the output file. As you have noticed already, it
suppresses the message that is output by raiserror.

The message:


'Job '<job name>' : Step <step number>, '<step name>' : Began Executing

<date time>'
cannot be suppressed.

Any reason you would like to suppress it?

--
Michiel Wories, SQL Server PM

This posting is provided "AS IS" with no warranties, and confers no rights.
---
"jps" <jyoti.s...@hp.com> wrote in message
news:148c101c2277c$dd9ae8a0$2ae2...@hosting.microsoft.com...

Keith Kratochvil

unread,
Jul 9, 2002, 4:36:39 PM7/9/02
to
May I suggest an email to sql...@microsoft.com
Your request/suggestion might make it into a future release.

--
Keith, SQL Server MVP


"jps" <jyoti.s...@hp.com> wrote in message
news:148c101c2277c$dd9ae8a0$2ae2...@hosting.microsoft.com...

jps

unread,
Jul 9, 2002, 4:55:32 PM7/9/02
to
We'd like suppress this Job output file header message
because we want the file to contain ONLY the (data) output
of a SELECT ... FOR XML EXPLICIT query, nothing else. This
output file will be read by another program which expects
an XML document as input.

We explored the use of isql to achieve this objective, but
it appears that this command-line utility cannot handle
the ... FOR XML EXPLICIT construct.

- jps

>.
>

Jasper Smith

unread,
Jul 9, 2002, 5:57:25 PM7/9/02
to
You can use bcp e.g.

bcp "select * from Northwind.dbo.Customers as Customer for xml auto"
queryout c:\customer.xml -T -c

If your other program can cope with an XML fragment then you're ok,
otherwise you can merge the root tags using the dos copy command or
whatever e.g.

copy /Y /B toproot.txt+customer.xml+endroot.txt customer2.xml
del /Q customer.xml

HTH
Jasper Smith

"jps" <jyoti.s...@hp.com> wrote in message

news:16ac301c2278a$f7195d80$9be62ecf@tkmsftngxa03...

Michiel Wories [MS]

unread,
Jul 9, 2002, 7:17:13 PM7/9/02
to
Can you tell me why isql/osql doesn't work in your case? I know there are
issues with line wrapping, but would like to understand your specific case.
Can you build a sample repro script that I can run?

--
Michiel Wories, SQL Server PM

This posting is provided "AS IS" with no warranties, and confers no rights.
---
"jps" <jyoti.s...@hp.com> wrote in message

news:16ac301c2278a$f7195d80$9be62ecf@tkmsftngxa03...

jps

unread,
Jul 10, 2002, 2:29:18 PM7/10/02
to
Michiel,

I haven't tried osql yet, but will do so since I now
understand that it is a (more advanced) replacement for
isql that may well handle the recent Transact-SQL
enhancements. The stored procedure that I ran using isql
generated an error when that procedure included a
SELECT ... FOR XML EXPLICIT query. However, when I
commented out that statement out it ran OK. More details
later.

- jps

>.
>

jps

unread,
Jul 10, 2002, 2:40:40 PM7/10/02
to
Michiel,

Below is an extract from BOL which explicitly states that
isql cannot retrieve results as XML documents. So the
error we got with isql trying to execute a stored
procedure that contained a SELECT ... FOR XML EXPLICIT
query was predictable. Will try osql now.

- jps

Extract from Books-On-Line:
-----------------------------------------------------------
The osql utility uses the ODBC database application
programming interface (API). It is a replacement for the
isql command prompt utility based on the DB-Library API.
Both utilities are provided with Microsoft SQL ServerT
2000. The DB-Library API remains at a SQL Server 6.5
level; therefore, applications that depend on DB-Library,
such as isql, do not support some SQL Server 2000
features. For example, isql cannot access columns defined
with the ntext data type and truncates any char, varchar,
nchar, or nvarchar columns longer than 255 bytes. It also
cannot retrieve results as XML documents. Except for these
limitations in isql, both osql and isql support the same
features.
-----------------------------------------------------------

>.
>

Michiel Wories [MS]

unread,
Jul 12, 2002, 6:44:18 PM7/12/02
to
You can try to set the output to a large number with the osql -w option and
concatenate results if needed.

--
Michiel Wories, SQL Server PM

This posting is provided "AS IS" with no warranties, and confers no rights.
---
"jps" <jyoti.s...@hp.com> wrote in message

news:16ddf01c22841$4a117ac0$9ae62ecf@tkmsftngxa02...

0 new messages