Solved

Decimal formats in MySQL

Posted on 2004-09-13
4
10,693 Views
Last Modified: 2012-06-21
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
0
Comment
Question by:vbturbo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 12045301
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
0
 
LVL 18

Author Comment

by:vbturbo
ID: 12045822
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
0
 
LVL 26

Accepted Solution

by:
Umesh earned 100 total points
ID: 12051974
Hi,



Some data types do not have a direct correlation between SQL Server or Access and MySQL. One example would be the CURRENCY data type: MySQL does not (yet) have a CURRENCY data type, but creating a column with the definition DECIMAL(19,4) serves the same purpose. While MSSQL defaults to Unicode character types such as nCHAR and nVARCHAR, MySQL does not so tightly bind character sets to field types, instead allowing for one set of character types which can be bound to any number of character sets, including Unicode.

take a look at

http://dev.mysql.com/tech-resources/articles/migrating-from-microsoft.html

0
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 12053289
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
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question