in reply to Re: Using DBI::Sybase having problem with Date format
in thread Using DBI::Sybase having problem with Date format

Thanks for the quick reply. I am looking at where I would include this in the script that i attached would I have to run the above as a seperate sql query within that script?
  • Comment on Re^2: Using DBI::Sybase having problem with Date format

Replies are listed 'Best First'.
Re^3: Using DBI::Sybase having problem with Date format
by derby (Abbot) on May 10, 2007 at 17:54 UTC

    I don't know which columns are dates (so, I'll assume those prefixed with dt are). For your test script, you would have to change from

    my $sth = $dbh->prepare_cached( "SELECT * FROM ReleaseDates" );
    to
    my $sth = $dbh->prepare_cached( "SELECT convert( char(8), dtXXX, 101 ) FROM ReleaseDates" );
    for the cgi:
    my $sth =$connection->prepare( "SELECT Release, dtTargetFeatureFreeze, dtTargetCCRB, dtTargetReleaseFromDev, dtTargetRTM, TwikiURL, ReleaseNum, Display FROM ReleaseDates WHERE (Display = 1)" );
    to
    my $sth =$connection->prepare( "SELECT Release, convert( char(8), dtTargetFeatureFreeze, 1), convert( char(8), dtTargetCCRB, 1), convert( char(8), dtTargetReleaseFromDev, 1), convert( char(8), dtTargetRTM, 1), TwikiURL, ReleaseNum, Display FROM ReleaseDates WHERE (Display = 1)" );
    -derby

    update: BTW, setting dateformat only affects inputting dates.

      Derby thank you so much !!! I have used your method on quite a few of my scripts now. Your an absolute legend. Thanks again for all your help. Michael I did try the whole
      $dbh->syb_date_fmt('MDY1_YYYY');
      but it just wouldn't workmaybe it was the way i was trying to include it into my script I will probably try and get it to work if i can. Thank you both for all your help