For Programmers: Free Programming Magazines  


Home > Archive > Clipper > May 2005 > field from numeric to character









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author field from numeric to character
happy

2005-05-23, 8:55 pm

How to change the type of a field from numeric to character without
changing the value of its content(field) ?

mno

2005-05-23, 8:55 pm

STR(x,l,d)
x = content of the field
l = total length of the field
d = decimal(s)

"happy" <ehab_aziz2001@yahoo.com> wrote in message
news:1116885250.301996.150430@f14g2000cwb.googlegroups.com...
> How to change the type of a field from numeric to character without
> changing the value of its content(field) ?
>



Ray Marron

2005-05-23, 8:55 pm

happy wrote:
> How to change the type of a field from numeric to character without
> changing the value of its content(field) ?


You can't change a DBF's structure once created. Basically, you will
have to create a new dbf with the desired structure and copy your
existing data into it, manually converting any fields that have changed
(in your case, the single numeric field) and copying those that didn't.

--
Ray Marron

Joe Wright

2005-05-24, 3:55 am

happy wrote:
> How to change the type of a field from numeric to character without
> changing the value of its content(field) ?
>


First, copy the .dbf to text file.

use oldb
copy to oldb deli && creates oldb.txt in delimited format
copy structure extended to estru

The file estru.dbf is a table that describes the structure of oldb.dbf
in exquisite detail. Find the numeric field entry of interest and change
its type to 'C' and decimals to 0.

create newb from estru
use newb
append from oldb deli

La voila.
--
Joe Wright mailto:joewwright@comcast.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com