Subject Re: [firebird-support] How to convert varchar variable to double type?
Author Helen Borrie
At 07:38 PM 18/10/2007, you wrote:
>Hi all, please tell me how to convert Varchar to double, Ex: I have a
>variable X = THDH4545 --> 4545 in double.

There is nothing in SQL that can convert an arbitrary string to a
number. You have to work out some algorithm by which you can
reliably extract a valid number from your string. How you apply this
algorithm depends on where such a variable is encountered - in input
data? in data that is already stored? - and processed - in a client
program? in an insert trigger?

Provide some information and someone might be able to help you.

For what it is worth, if you extracted the number 4545 from the
example above, and then treated it as SQL type DOUBLE PRECISION, it
would NOT be exactly 4545. It would be 4545 +/- some small amount,
determined by the processor that does the implicit
integer-to-floating-point conversion.

PLEASE do not hijack other people's threads. It messes up
archive-threading. Create a new message when you ask a new question.

^ heLen