Seeliger.Curt at epamail.epa.gov
2009-Mar-17 19:12 UTC
[R] RODBC changes data types when reading from MS SQL Server 2005 -- How to fix?
Folks, As reproduced in the code below, our data is being transformed during the sqlFetch() operation. This has apparently been an issue since 2002. Are there any ways for correctly reading data from MS SQL Server 2005? Why does RODBC ignore the type information supplied by SQL Server? require(RODBC) lakes <- odbcConnect('Lakes',uid='cseelige') tt <- data.frame('a'='1234', 'b'='5678', 'c'=123.456, stringsAsFactors=FALSE) sqlSave(lakes, tt, tablename='testtest', verbose=FALSE, safer=FALSE, test=FALSE, append=FALSE, fast=FALSE, rownames=FALSE) # This shows the columns exist as varchar, varchar, float on the server sqlColumns(lakes, 'testtest') # This shows the columns are fetched as int, int, num instead of chr, chr, num. str(sqlFetch(lakes, 'testtest')) Thank you for your time, cur -- Curt Seeliger, Data Ranger Raytheon Information Services - Contractor to ORD seeliger.curt@epa.gov 541/754-4638 [[alternative HTML version deleted]]