Re: [R] RODBC: How to Retrieve a Column as Rownames?

From: Prof Brian Ripley <>
Date: Wed 01 Feb 2006 - 21:02:31 EST

On Wed, 1 Feb 2006, Markus Preisetanz wrote:

> Dear Collegues,
> when using sqlQuery from the package RODBC I always get a data frame with automatically generated rownames, even if:
> * the first column of the query is called rownames using "Select ... AS rownames, ... From ..."
> * and: the values from this column are unique
> * and: the values are inevitably forced to character data with e.g. " 'rn_' + CAST(xy AS NVARCHAR) "
> It works with sqlFetch but I would have to define a view for every
> query. Does anybody know help?

Well, you use ?sqlQuery to find out, as I just did. What is so hard about that?

This is documented feature of sqlFetch, and not mentioned at all as supported by sqlQuery. As sqlFetch is a wrapper for sqlQuery you can just write your own wrapper based on it.

The (unacknowledged) maintainer of RODBC, and author of this feature.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Wed Feb 01 21:13:18 2006

This archive was generated by hypermail 2.1.8 : Thu 02 Feb 2006 - 02:13:47 EST