PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Stopping TSQL 'print' from going to stderr
Date: Nov 11 2003 12:30AM

On Mon, 2003-11-10 at 08:30, Avis, Ed wrote:
> How can I make the output of TSQL 'print' statements go to my
> script's stdout instead of stderr?
> 
> I have set up an error handler
> 
>     $dbh->{syb_err_handler} = sub {
>         my ($err, $sev, $state, $line, $server,
>             $proc, $msg, $sql, $err_type) = @_;
>         print "number $err, message $msg\n";
>     };
> 
> and sure enough this makes 'print' messages go to standard
> output.  But they still appear on stderr as well!  I've also
> tried turning off PrintError but that doesn't help.

Return 0 from the error handler for any message that you want to "hide".

(At least that's how it's supposed to work!)

BTW - PRINT statements always have a message number of 0.

Michael
-- 
Michael Peppler                              Data Migrations, Inc.
mpeppler@peppler.org                 http://www.mbay.net/~mpeppler
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short or 
long term contract positions - http://www.mbay.net/~mpeppler/resume.html