Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-sqlserver > #2158
| Date | Fri, 19 Aug 2022 17:44:28 +0200 |
|---|---|
| MIME-Version | 1.0 |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 |
| Subject | Re: `sqlcmd' withholding error messages? |
| Newsgroups | comp.databases.ms-sqlserver |
| References | <20220811131035.f10b114df6b905668746c2ab@g{oogle}mail.com> |
| Content-Language | en-US |
| From | Luuk <luuk@invalid.lan> |
| In-Reply-To | <20220811131035.f10b114df6b905668746c2ab@g{oogle}mail.com> |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Message-ID | <nnd$0ac332a1$732489f3@eef0fc901d3b0f44> (permalink) |
| Organization | KPN B.V. |
| Path | csiph.com!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe005.abavia.com!abp002.abavia.com!news.kpn.nl!not-for-mail |
| Lines | 53 |
| Injection-Date | Fri, 19 Aug 2022 17:44:27 +0200 |
| Injection-Info | news.kpn.nl; mail-complaints-to="abuse@kpn.com" |
| X-Received-Bytes | 2831 |
| Xref | csiph.com comp.databases.ms-sqlserver:2158 |
Show key headers only | View raw
On 11-8-2022 12:10, Anton Shepelev wrote: > Greetings to master Erland and all good people prefer- > ring the cleanliness and freedom of Usenet to clut- > tered and centralised web-based media. On a dedicated > machine I host many SQL Server instances and perform > some regular maintenance operations via `sqlcmd' in- > voked in a batch script in a loop over a file with a > list of instances. The relevant fragment is shown be- > low: > > for /F %%f in (instances.txt) do ( > sqlcmd -A -r 0 -b -l 4 -t 120 -S SBOSQL%f -i %SCR_PAT%%s 2> error.txt > IF ERRORLEVEL 1 ( > echo %DATE% %TIME%: >> errors.txt > echo Error invoking %SCR_PAT%%s for %%f: >> errors.txt > type error.txt >> errors.txt > echo -- >> errors.txt > ) > del error.txt > ) > > Most of the time is works as expected, but on rare oc- > casion the log file will contain error entries with an > empty message, e.g.: > > Thu 08/11/2022 13:04:12.46: > Error invoking mem_bal _mem_balance.sql for SBO35: > -- > > Which means that `sqlcmd' returned an error code yet > did not print any message to standard output. Do I in- > voke it incorrectly? > -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. (source: https://docs.microsoft.com/en-us/sql/tools/sqlcmd-utility?view=sql-server-ver16) Conclusion: Do not use `-r 0` because of "if you specify 0, only error messages that have a severity level of 11 or higher are redirected."
Back to comp.databases.ms-sqlserver | Previous | Next — Previous in thread | Next in thread | Find similar
`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