Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Wed, 14 Feb 2001 @ 22:41:45 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: Datediff function
From:   Mark Landry

Phillipp raises a related question... is there any way that DBD::Teradata (the official name of Dean's Perl DBI Teradata driver) can return the ANSI date format instead of the native Teradata integer form without cast-ing in the query?

Here's a small code sample for those interested:

     use strict;
     use DBI;
     use DBD::Teradata;

     my $opt = {RaiseError => 1, ChopBlanks => 1};
     my $tdh = DBI->connect( 'DBI:Teradata:dbccop1', 'user', 'passwd', $opt)
             || die $DBI::errstr;

     my $tdsth = $tdh->prepare(
             "select current_date,
                     cast(current_date as char(10)),
                     current_date - date '2001-01-01'" );


     while( my @row = $tdsth->fetchrow_array() ) {
             print "@row\n";



     $ perl TDdatediff.pl
     1010214 01/02/14 44

  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016