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 mbay dot net>
Subject: how to select - date values from getdate() in sybperl.
Date: Oct 12 1998 1:58PM

Perumal, Saravana writes:
 > $dbh = Sybase::CTlib->ct_connect('user','pass','serv','db');
 > $stt = "declare \@edate char(30)";
 > $stt .= " SELECT \@edate = convert( char(30), getdate(), 109) ";
 > print $stt;
 > 
 > $dbh->ct_execute("$stt");
 > 
 > while (( $rc = $dbh->ct_results($restype)) == CS_SUCCEED) 
 > {
 >         next if ( $restype == CS_CMD_FAIL || $restype == CS_CMD_SUCCEED
 > || $restype == CS_CMD_DONE);
 > 
 >         while (%dat = $dbh->ct_fetch(1))
 >        {
 >         print "Test";
 >         print "Value --> $dat{edate}\n";

You are expecting a column called edate.

In this case you aren't getting it - actually you're not getting
anything at all, because 

select @edate = ...

will not return any results - it just assigns the appropriate date to
the @edate variable.

You need to execute something like

	select 'edate' = convert(char, getdate(), 109)

and things should work a lot better.

Michael
-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@mbay.net       -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com