[Last Call] Learn how to a build a cloud-first strategyRegister Now


MySQL set Length/decimal for Double and bigint

Posted on 2011-05-03
Medium Priority
Last Modified: 2012-06-27
I want to store OAdateTime in MySQL column (double)

What would be setting fro Length and Precision?

For bigint i set lenght to 20 and 0 for precision is this alright?

Question by:JSW21
  • 2
LVL 41

Accepted Solution

Sharath earned 750 total points
ID: 35514925
Is OAdateTime a date column? Then why don't you define it as datetime or date depending on your data?
LVL 60

Assisted Solution

by:Kevin Cross
Kevin Cross earned 750 total points
ID: 35514974
I agree with Sharath.  If you do, however, have to store as a DOUBLE, then use that data type or DECIMAL and not BIGINT.  A double-precision floating point number is imprecise and can go up to 53 digits in precision --- if you are trying to simulate the length then go with DECIMAL.

Author Comment

ID: 35605714
MySQL do not have millisecond so i need to use such field.
But my data require primary key on OAdateTime would the float(0,0) works?

Author Closing Comment

ID: 35671700
I got my problem solve. When create double I should just let the database decide the precision.

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

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

In this article, we’ll look at how to deploy ProxySQL.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

829 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