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$
  • $\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$ – Ariel Sepulveda Jun 5 '15 at 2:43
  • $\begingroup$ Comment reposted as an answer. $\endgroup$ – ilian Jun 5 '15 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$ – Ariel Sepulveda Jun 6 '15 at 14:53
  • $\begingroup$ Yes, it only seems to accept integers. Perhaps use SQLExecute with your desired CREATE TABLE statement? $\endgroup$ – ilian Jun 6 '15 at 15:17
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, privacy policy and cookie policy

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