[R-sig-DB] Pruary keys in an Access database via RODBC

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Feb 26 08:02:28 CET 2009

>From the help (but please read for yourself)


      A data frame on success, or character/numeric on error depending
      on the 'errors' parameter.  If no data is returned, either a
      zero-row data frame or an error. (For example, if there are no
      primary keys or special column(s) in this table an empty data
      frame is returned, but if primary keys are not supported by the
      DBMS, an error code results.)

Try errors=TRUE for a text error message: on my system it says that 
the ODBC driver does not support primary keys.

If that is the case for you (and I belive my drivers are up to date), 
you need to ask Microsoft why.  (I do not cosider Access to be a 
serious DBMS, and SQL Server's ODBC driver does support primary keys.)

Plese use a sensinle subject line (I've changes it): see the R posting 

On Wed, 25 Feb 2009, Rad Nag wrote:

> I am using R to access (.mdb) files (created in Microsoft access 2003) through RODBC.
> I
> am able to view the Tables and also list their attributes through the
> sql............. commands. However, when try to acces the primary keys
> (using sqlPrimaryKeys /odbcPrimaryKeys) I get a value of? '-1' on my command line,
> i.e. I am unable to identify the PrimaryKeys in the Tables.
> Any suggestions why this would happen.
> The same problem persists for files created by Access 2007.
> 	[[alternative HTML version deleted]]

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-sig-DB mailing list