FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Add decimals to an existing numeric field
Posts: 564
Joined: Thu Oct 13, 2005 09:23 AM
Add decimals to an existing numeric field
Posted: Thu Aug 23, 2012 02:30 PM

Hello,
I've a dbf with a numeric field without decimals. I would change the field adding 2 decimals, but I don't know. When I hace to change the structure of a DBF I create a nuew structure with dbcreate and then append the data from the old dbf. Doing this with character fields doesn't give an error, but if I do this with numeric field adding decimals it give me an error.

I use EMAGdbu from Enrico and this program changes the size of the numeric fields without problems, but I don't know how to do this in my programs.

Regards,
José Luis

Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: Add decimals to an existing numeric field
Posted: Thu Aug 23, 2012 02:40 PM

Hi,

Please, have a took at Fivedbu sources, there is such routine.

Muchas gracias. Many thanks.



Un saludo, Best regards,



Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]



Implementando MSVC 2010, FWH64 y ADO.



Abandonando uso xHarbour y SQLRDD.
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: Add decimals to an existing numeric field
Posted: Thu Aug 23, 2012 04:29 PM

Jose Luis:

Perhaps the problem is the field's size, remember, you will need a field size + 3, for sample:

If your field has a lenght 7 with no decimals (7,0), (1234567) when you add the decimals
you need a field with leght 10 with 2 decimals, 1234567.89

Regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 564
Joined: Thu Oct 13, 2005 09:23 AM
Re: Add decimals to an existing numeric field
Posted: Fri Aug 24, 2012 06:05 AM

I have downloaded the latest public fivedbu sources from code.google. The routine in fivedbu sources is the same I use, and gives the same error when you change a numerical field with 2 integer positions - numeric (2,0) - to another with 2 integer positions and 2 decimals - numeric (5,2) -.

Any help, please ?

Regards,

Continue the discussion