Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.databases.ms-sqlserver > #2160

Re: `sqlcmd' withholding error messages?

From Anton Shepelev <anton.txt@g{oogle}mail.com>
Newsgroups comp.databases.ms-sqlserver
Subject Re: `sqlcmd' withholding error messages?
Date 2022-08-22 17:46 +0300
Organization A noiseless patient Spider
Message-ID <20220822174622.48bf464fa2922e017f8b8714@g{oogle}mail.com> (permalink)
References <20220811131035.f10b114df6b905668746c2ab@g{oogle}mail.com> <nnd$0ac332a1$732489f3@eef0fc901d3b0f44> <20220822123952.e80b413b6a97e34fb150cf27@g{oogle}mail.com>

Show all headers | View raw


I wrote:

> Luuk:
>
> > -r[0 | 1]
> > Redirects the error message output to the screen
> > (stderr). If you do not specify a parameter or if you
> > specify 0, only error messages that have a severity
> > level of 11 or higher are redirected. If you specify 1,
> > all error message output including PRINT is redirected.
> > Has no effect if you use -o. By default, messages are
> > sent to stdout.
>
> Yes. I inovke `sqlcmd' not only with -r 0, but also with
> -b:
>
>    -b
>    Specifies that sqlcmd exits and returns a DOS ERRORLEVEL
>    value when an error occurs. The value that is returned to
>    the DOS ERRORLEVEL variable is 1 when the SQL Server error
>    message has a severity level greater than 10
>
> The invocation sqlcmd -r 0 -b should either succeed or
> print an error message in stderr. In my case, however, it
> failed but did not send anything to stderr.

To clarify -- my purpose is to cause `sqlcmd' to terminate
with non-zero error code and to send the output to STDERR in
on errors of severity 11 or highter, and to continue
exeuction and send output to STDOUT otherwise.  I believe my
invocation is should achieve that end, does it not?

-- 
()  ascii ribbon campaign - against html e-mail
/\  http://preview.tinyurl.com/qcy6mjc [archived]

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Find similar


Thread

`sqlcmd' withholding error messages? Anton Shepelev <anton.txt@g{oogle}mail.com> - 2022-08-11 13:10 +0300
  Re: `sqlcmd' withholding error messages? Erland Sommarskog <esquel@sommarskog.se> - 2022-08-12 22:45 +0200
    Re: `sqlcmd' withholding error messages? Anton Shepelev <anton.txt@g{oogle}mail.com> - 2022-08-19 17:52 +0300
  Re: `sqlcmd' withholding error messages? Luuk <luuk@invalid.lan> - 2022-08-19 17:44 +0200
    Re: `sqlcmd' withholding error messages? Anton Shepelev <anton.txt@g{oogle}mail.com> - 2022-08-22 12:39 +0300
      Re: `sqlcmd' withholding error messages? Anton Shepelev <anton.txt@g{oogle}mail.com> - 2022-08-22 17:46 +0300

csiph-web