Add decimals to an existing numeric field

Add decimals to an existing numeric field

Postby José Luis Sánchez » Thu Aug 23, 2012 2: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
User avatar
José Luis Sánchez
 
Posts: 556
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España

Re: Add decimals to an existing numeric field

Postby lucasdebeltran » Thu Aug 23, 2012 2: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.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: Add decimals to an existing numeric field

Postby Armando » Thu Aug 23, 2012 4: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
User avatar
Armando
 
Posts: 3222
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Add decimals to an existing numeric field

Postby José Luis Sánchez » Fri Aug 24, 2012 6: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,
User avatar
José Luis Sánchez
 
Posts: 556
Joined: Thu Oct 13, 2005 9:23 am
Location: Novelda - Alicante - España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 31 guests