Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


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

`sqlcmd' withholding error messages?

Path csiph.com!news.mixmin.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From Anton Shepelev <anton.txt@g{oogle}mail.com>
Newsgroups comp.databases.ms-sqlserver
Subject `sqlcmd' withholding error messages?
Date Thu, 11 Aug 2022 13:10:35 +0300
Organization A noiseless patient Spider
Lines 35
Message-ID <20220811131035.f10b114df6b905668746c2ab@g{oogle}mail.com> (permalink)
MIME-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
Injection-Info reader01.eternal-september.org; posting-host="bae8fc74ba5b2ee9823084d9e3a78901"; logging-data="2262670"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX180LgRWZ+J03RwoB8IPDuVOSTO3d4KNPCY="
Cancel-Lock sha1:k/TPvoL9bwclBjn93bi/WgaIl6s=
X-Newsreader Sylpheed 3.5.0 (GTK+ 2.24.23; i686-pc-mingw32)
Xref csiph.com comp.databases.ms-sqlserver:2155

Show key headers only | View raw


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?

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

Back to comp.databases.ms-sqlserver | Previous | NextNext 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