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: Differences in convert()ed AM/PM times
Date: Jan 23 2002 4:29PM

David LANDGREN writes:
 > |I think the fundamental problem with:
 > |
 > |    select convert(char(20),max(my_date, 109) from t
 > |
 > |is that the string is too short and so the time part of the string is
 > |truncated.
 > 
 > Omigod, how embarrassing. I wince at the thought of the amount of time I
 > wasted on this yesterday.

BTW - you can also use the following:

[21] ecircles_plum.qa: 1> select convert(varchar, getdate(), 109)
[21] ecircles_plum.qa: 2> go
                               
 ------------------------------
 Jan 23 2002  8:28:21:396AM    

(1 row affected)

i.e. not specify the width of the varchar column - it gets sized
appropriately (at least on 11.9.x and later - I don't have an 11.5
running on which to test at short notice)

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