Re: SQLCMD "-r" option (SQL 2K5)
- From: "Mike C#" <xxx@xxxxxxx>
- Date: Wed, 31 May 2006 22:51:41 -0400
Oops, I meant I was testing with -m, not -V; although I'll probably test
with both :)
Thanks
"Erland Sommarskog" <esquel@xxxxxxxxxxxxx> wrote in message
news:Xns97D517E72650Yazorman@xxxxxxxxxxxx
Mike C# (xxx@xxxxxxx) writes:
OK, so I'm playing with SQLCMD and trying to get the "-r" option to
work. According to BOL it's supposed to redirect error messages of
severity level 17 or higher to the screen (stderr). Presumably this
would be useful in situations where you're running a script with the
"-o" option, so that output would be sent to a file and error messages
would be sent to the screen and not included in the output file. When I
run it in the following:
sqlcmd -S SQL2005 -Q"raiserror('Error in text', 17, 1)" -r 0 -o test.txt
or
sqlcmd -S SQL2005 -Q"raiserror('Error in text', 17, 1)" -r 1 -o test.txt
The error message is sent to the output file (test.txt) and not to the
screen. Is there another option that needs to be set, or am I reading
the
documentation wrong?
The documenation does not appear to be very clear. And it's flat wrong
on one point.
If you specify the output file with -o, -r has no effect. However, if you
use > for the output file, -r works as advertised. Almost. The cutoff
level
is 11, not 17.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- Re: SQLCMD "-r" option (SQL 2K5)
- From: Erland Sommarskog
- Re: SQLCMD "-r" option (SQL 2K5)
- Prev by Date: Re: Using Query Analyzer with SQL 2005
- Next by Date: Re: Using Query Analyzer with SQL 2005
- Previous by thread: Re: SQLCMD "-r" option (SQL 2K5)
- Next by thread: Re: Using Query Analyzer with SQL 2005
- Index(es):
Relevant Pages
|