[R] RODBC and SQlServer Float type

Enrique Bengoechea enrique.bengoechea at credit-suisse.com
Wed Apr 21 13:37:25 CEST 2004


I'm trying to get data from a MS SqlServer database into R, using the RODBC package. The problem I've found is that numeric data from my sql queries is returned with only two decimal digits.

After searching the docs, I think the problem comes from my sql numeric data having "float" type instead of "double", as I found the following:

"Where possible sqlGetResults transfers data directly: this happens for double, real, integer and smallint columns in the table. All other SQL data types are converted to character strings (of length up to 256), and then converted by type.convert as
controlled by the as.is argument."

What I did not found was a way to get back more than two decimal digits in this character-numeric transformation. I would acknowledge any clue as to whether this is possible.

Thanks in advance!


Enrique Bengoechea
Investment Consulting - CREDIT SUISSE Spain

More information about the R-help mailing list