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: "Meetings: A practical alternative to work" <gardner at stsci dot edu>
Subject: Don't want error message printed out
Date: Mar 14 1996 5:31PM

I wrote the following piece of perl to make sure the date
I'm being passed in is valid and to convert it to the form
I can use later in my program.

$date1 = "29-feb-1995";
$query = <<"EOQ";
declare \@tdate datetime select \@tdate = '$date1'
select convert(char(12),\@tdate,107)
EOQ
die if $db1->dbcmd($query) == &FAIL;
die "'$date1' is a bad date - try again\n" if $db1->dbsqlexec == &FAIL;
die if $db1->dbresults == &FAIL;
die if $db1->dbresults == &FAIL;
($the_date) = $db1->dbnextrow;
print "The output date is: $the_date\n";

The output is:

Msg 242, Level 16, State 3
Server 'gummo', Line 1
        The conversion of CHAR to DATETIME resulted in a DATETIME value out of .
DB-Library error:
        General SQL Server error: Check messages from the SQL Server.
'29-feb-1995' is a bad date - try again

What I would like is to suppress the the server message and only 
print out the message I supply.

Any and all help would be appreciated.

Lisa Gardner
gardner@stsci.edu