Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Integer field too short, convert to a string
Fri, Jul 14 2006 10:43 AMPermanent Link

Jerry Blumenthal
I used an integer field for checknumbers, but (at least in D4 and dbisam
2.12) the integer field only goes up to 2147483647, and I often need
several more digits.

So unless there is some other way, I will need to replace the integer
field with a string, 14 chars long.  I'd like to do this without data loss.

is there any way to use CAST or REDEFINE to convert the integer to a string?

If not, am I best off---
1. first ADDing the new field: 'ADD sCheckNumber CHAR(14),'
2. then using a dbisamTABLE to iterate through the records, inttostr to
         do the data conversion
3. finally DROP the old field?

Jerry
Fri, Jul 14 2006 11:13 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jerry


Don't know about 2.12 but try a script

ALTER TABLE tbl ADD sCheckNumber CHAR(14),
UPDATE TABLE tbl SET sCheckNumber =  CAST(oldfield AS CHAR(14);
ALTER TABLE tbl DROP oldfield;


Roy Lambert
Image