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? SQL-Server: MS SQL 2000 ___________________ Markus Preisetanz Consultant Client Vela GmbH Albert-Roßhaupter-Str. 32 81369 München fon: +49 (0) 89 742 17-113 fax: +49 (0) 89 742 17-150 mailto:markus.preisetanz@clientvela.com <mailto:markus.preisetanz@clientvela.com> Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet. This e-mail may contain confidential and/or privileged infor...{{dropped}}
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, 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
Maybe Matching Threads
- aggregate data.frame using column-specific functions
- scatterplot3d: how to show scatterpoints in 2D-space with color as 3rd dimension?
- AID / Tree Analysis in R
- Adding dimnames to image()
- cluster analysis: "error in vector("double", length): given vector size is too big {Fehler in vector("double", length) : angegebene Vektorgröße ist zu groß}