Re: Trimming field data
Posted in 1995
>Can anybody tell me if there is a way to trim data in an informix
>database. I currently have data in a field that has spaces tagged onto
>the end of it and I would like to remove it.
>
>Any ideas would be appreciated.
Dear Dean,
Do you want to set the length of the field in the database to the maximum
length of actual data in the field, or do you want to (say) print it without
trailing characters?
If you want to print the data, you use the CLIPPED attribute, i.e.
PRINT char_field CLIPPED
If you want to know the maximum length of data in a CHAR field, then
SELECT max(length(char_field))
FROM table_name
Then :
ALTER TABLE table_name MODIFY (char_field CHAR(length_as_returned_by_select))
(or something like that... :)
HTH.
--
Cheers,
Billy
-----------------------------------------------------------------------------
INCLUDE "Disclaimer.4gh" -- my opinions are
INCLUDE "FlamesToDevNull.4gh" -- flamers, eat my shorts!
INCLUDE "CaveatEmptor.4gh" -- take my advice at your own risk
INCLUDE "ThirtySomething.4gh" -- header file for this class
-- Written by : Billy Wheeler, Date: today
-- Copyright (c) 1995, The West Solutions Group