Link to home
Start Free TrialLog in
Avatar of vbturbo
vbturboFlag for Denmark

asked on

Decimal formats in MySQL

Hi all

How do i define a currency format in mySql
I have imported a Access database table to mySql

Got a collum containing prices  with 2 decimal after a comma... like this    7,25  euro
but after the import / conversion   i only get                                            7      euro  in the table  

i made a dump file where i clipped this behavior

`Pris` DECIMAL DEFAULT 0,

So is it possible to define the above pice of code to containe 2 decimals after the comma

thanks in advance

rgds Jens
Avatar of VincentPuglia
VincentPuglia

Hi,

  Don't know why you have commas instead of decimals, but I would convert the comma to a decimal '.' and then import it as a decimal.  You can display the values with a comma later on as needed, but you should maintain it as decimals

Vinny
Avatar of vbturbo

ASKER

Hi there

Got your point.....but was my mistake "sould have been a dot  7.25 " european display format

But my question was if i got a collum containing different price's and  how do i format the
decimals

 example        Price
             ------------------
                     100.75
                 75000.50

Hope you understand my question

jens
ASKER CERTIFIED SOLUTION
Avatar of Umesh
Umesh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

  When you say 'format the decimals' , exactly what are you talking about?
  For the database column?  ushastry's answer will do.  
  For display?  That would depend on the language you are using, not the dbms

Vinny