Re: LENGTH function and trailing spaces
Posted in 1995
Now I also see what you mean. I think you could probably get round your
problem by doing the following.
SELECT LENGTH(vc+"B") -1 FROM kirk
It should work but I have not tried it.
> I now see what I was saying wrong. I kept saying CHAR and I meant
> VARCHAR. According to the Guide to SQL: Reference manual (pg 3-18 Data
> types) > "The database server does NOT strip a VARCHAR object of any >
user-entered trailing blanks, nor does the database server
> pad the VARCHAR to the full length of the column."
> > ok.. so the question is: if I do this:
> > CREATE TABLE KIRK (VC VARCHAR(100))
> > INSERT INTO KIRK VALUES ('KIRK AND 2 TRAILING BLANKS ')> > then how do I find out (in a SQL stmt (no 3-GL code)) that
> the length stored for that INSERT is 28 cause LENGTH(VC)
> will surely return 26 won't it?
> > > > > Watje, Paul (watjep@emspo01.hasting.com) wrote:
> > : Just look in a manual at the definition for syscolumns and it will
> give you : the length
> : of a char field. I just wrote a small 4gl to re-create an image of a
> table : and had to
> : do something similar.
> : =====================================================================
> : Paul Watje Database Something or Another
> : watjep@hasting.com Hastings Books, Music, & Video
> > : ----------
> : From: ilist
> : To: informix-list
> : Subject: LENGTH function and trailing spaces
> : Date: Tuesday, April 04, 1995 9:14PM
> > > : Length is documented as returning the length of a character
column,
> : not including the trailing spaces. What method do I use IN SQL to
> : get the REAL length of character column? i.e. what size would be
> : available to a program that fetched that column
> > : --
> : Kirk Bradley
> : Oracle Corporation
> : Mainframe and Integration Technologies Group
> > > --
> Kirk Bradley
> Oracle Corporation
> Mainframe and Integration Technologies Group
>
Malcolm Weallans
Online Database Consultancy
2 Arkley Court
Maidenhead
Berks
SL6 2YR
Phone 0628-72154
Fax 0628-37463
CIX - onlinedbc