1
$\begingroup$

Some databases (e.g. MySQL) does not store decimal places for seconds unless the number of digits needed is directly specified (e.g. DATETIME(4) for 4 digits) when creating the table in the database. Using SQLCreateTable the number of characters in a VarChar column is specified using "DataLength"->k for a SQL interpretation of VARCHAR(k). I would like to know if there is a similar option to "DataLength" that would work to specify the number of precision digits required for the seconds. Similarly, REAL, NUMERIC, and other data types share analog problems to specify the number of precision digits.

$\endgroup$
4
  • $\begingroup$ @ilian: That solution also worked for NUMERIC data type. So, apparently "DataLength" would work to supply a second parameter to data types. So your comment seems to be the answer. Thanks. $\endgroup$ Commented Jun 5, 2015 at 2:43
  • $\begingroup$ Comment reposted as an answer. $\endgroup$
    – ilian
    Commented Jun 5, 2015 at 14:17
  • $\begingroup$ @ilian: Apparently there is still the need of a second parameter. For example, to get DECIMAL(5,2) in MySQL "DataLength"->{5,2} does not work. $\endgroup$ Commented Jun 6, 2015 at 14:53
  • $\begingroup$ Yes, it only seems to accept integers. Perhaps use SQLExecute with your desired CREATE TABLE statement? $\endgroup$
    – ilian
    Commented Jun 6, 2015 at 15:17

1 Answer 1

1
$\begingroup$

Yes, the value of the DataLength option will get appended to any type.

For example, to obtain DATETIME(4) just set the SQLColumn options "DataTypeName" -> "DATETIME" and "DataLength" -> 4.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.