[R] setSqlTypeInfo function in RODBC package

Peter Holck holck at hawaii.edu
Fri Oct 19 03:38:17 CEST 2007

I'm a little confused about what I'm doing wrong using the setSqlTypeInfo
function to modify character size output:

> setSqlTypeInfo("MySQL",
+               list(double="double",
+                     integer="integer",
+                     character="varchar(30)",
+                     logical="varchar(5)"))

I would expect the character type for "MySQL" driver now to default to
varchar(30) rather than varchar(255).  But that doesn't appear to be the

> getSqlTypeInfo()
                               double integer    character      logical
MySQL                          double integer varchar(255)   varchar(5)
ACCESS                         DOUBLE INTEGER VARCHAR(255)   varchar(5)
Microsoft.SQL.Server            float     int varchar(255)   varchar(5)
PostgreSQL                     float8    int4 varchar(255)   varchar(5)
Oracle               double precision integer varchar(255) varchar(255)
SQLite                         double integer varchar(255)   varchar(5)
EXCEL                          NUMBER  NUMBER VARCHAR(255)      LOGICAL
DBASE                         Numeric Numeric    Char(254)      Logical

Reason I'm doing this is that I have a dataframe with nearly 3,000
variables, many of them character, and sqlSave to MySQL fails with the
suggestion that I need to change some columns to TEXT or BLOBs  (I'm
assuming since all are defaulting to varchar(255) rather than smaller
varchar values).

Using R version 2.5.0 RC (2007-04-19 r41248) with WinXP Professional.

Any insight appreciated!


More information about the R-help mailing list