Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread redefine column using alter table
Wed, Apr 3 2013 4:58 PMPermanent Link

Kees Lagendijk


Hi,

I want to redefine field "amountA" from "float" to "currency" with the following SQL:

Alter table ledger redefine amountA currency default 0

However, now the fieldname is being changed into currency and - needless to say - that is not what I want.

What am I doing wrong?

Greet,
Kees Lagendijk
Wed, Apr 3 2013 7:26 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Kees ,

There's no "Currency" SQL type, the equivalent type is MONEY:

   ALTER TABLE Ledger REDEFINE "amountA" MONEY DEFAULT 0

However, MONEY values are stored as floating point values, exactly as FLOAT, the only difference being the display format. I'm not sure if that is what you are looking for or if instead you are wanting to change it to a fixed-point format like the SQL type DECIMAL (BCD in DbSys); if that is the case then the correct statement would be:

   ALTER TABLE Ledger REDEFINE "amountA" DECIMAL(19, 2) DEFAULT 0


--
Fernando Dias
[Team Elevate]
Image