Este es un ejemplo de como hacerlo, creo que es parecido a lo que  te mando alguien del foro, checalo y espero que te sirva

Saludos

------------------------------------------------------------------------------------------------------------

Query/400 does not provide a native method for converting character data to numeric, but with the following hack, the conversion is possible. I have a character field (four digits) that's used for generic purposes in a particular database file. Although the field's format is character, the field sometimes represents numeric data. To perform math operations on such data in Query, you must first convert the field to numeric. By using the MICROSECOND keyword in the Define Result Fields section of Query, you can convert the character data to a numeric field for later use in calculations.

For example, create a field called TIMESTAMP using Query's Define Result Fields panel, specifying

 '1988-12-25-17.30.00.00' || CHARFIELD4 

in the panel's _expression_ column. The field CHARFIELD4 in this example represents a four-digit character field containing the characters 0 (zero) through 9 (nine).

Next, use the MICROSECOND keyword on the TIMESTAMP field to create a numeric copy of CHARFIELD4's character data. Here's what the Define Result Fields panel will look like:

Field                    _expression_                    Column Heading     Len     Dec

TIMESTAMP     '1988-12-25-17.30.00.00' || CHARFIELD4         26

NUMERIC6         MICROSECOND(TIMESTAMP)                             0

The MICROSECOND keyword takes the six rightmost digits in the TIMESTAMP field and converts them to numeric. In the example, the character field is only four digits long, so 00 is concatenated with the character field to create a valid timestamp with six digits of milliseconds.If a given character field is larger than six digits, you'll need to break down the above process into multiple steps and perform a math operation on the individual numeric components to combine them.

-------------------------------------------------------------------------------------------------------------

Gerardo Santillana
IT Department
Delphi Mechatronic Systems
US Ph: (956) 554.5832
MX Ph: (88) 12.81.63/64/65 Ext. 5832
e-mail [EMAIL PROTECTED] 

-----Original Message-----
From: Nora Martinez [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 27, 2003 3:28 AM
To: Foro help400
Subject: CONVERTIR CARACTER A NUMERICO EN QUERY
Importance: High


hola a todos, 
 
ten�a anotado que de la siguiente forma: INTEGER(SUBSTR(CAMPO, 1, 20))  se pod�a convertir una serie de caracteres en num�rico pero ahora lo estoy probando y no lo consigo, parece como si no reconociera el INTEGER como operador. Alguno de  vosotros lo utiliz�is as� ? ten�is otra forma de hacerlo? (en un query). 
 
gracias,
 
Nora.

Responder a