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

x
?
Solved

MySQL set Length/decimal for Double and bigint

Posted on 2011-05-03
4
Medium Priority
?
672 Views
Last Modified: 2012-06-27
Hello
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?

Thanks,
0
Comment
Question by:JSW21
  • 2
4 Comments
 
LVL 41

Accepted Solution

by:
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?
0
 
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.
0
 

Author Comment

by:JSW21
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?
0
 

Author Closing Comment

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

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