[R] RODBC: longest string is truncated
Yeh, Richard C
richard.c.yeh at bankofamerica.com
Thu Oct 12 00:00:12 CEST 2006
Dear Jerome,
Sorry, I'm not running your configuration. I cannot reproduce this
problem with Sybase Adaptive Server IQ 12.6 and R 2.3.1 + RODBC 1.1.7 on
WinXP SP2 or Linux 2.4.21-32.0.1.ELsmp #1 SMP Tue May 17 17:52:23 EDT
2005 i686 i686 i386 GNU/Linux.
-- ASIQ uses STRING() to mean CONCAT()
-- ASIQ doesn't have the 'TEXT' data type
CREATE TABLE test500
(
a VARCHAR(600) -- explicit length
)
GO
INSERT INTO test500
SELECT STRING(REPEAT('a',499),'1') -- should be a length-500 string
GO
INSERT INTO test500
SELECT STRING(REPEAT('a',499),'12')
GO
INSERT INTO test500
SELECT STRING(REPEAT('a',499),'123')
GO
SELECT LENGTH(a) FROM test500
-- returns 500, 501, 502
Then, in R (either platform):
> library(RODBC)
> channel = odbcConnect('DSN', believeNRows=FALSE) #
believeNRows=FALSE required for ASIQ
> b = sqlQuery(channel,"SELECT a FROM test500")
> nchar(as.vector(b[[1]]))
[1] 500 501 502
212-933-3305 / richard.c.yeh at bankofamerica.com
-----Original Message-----
Subject: [R] RODBC: longest string is truncated
Date: Wed, 04 Oct 2006 17:55:02 -0400
Hello R community:
I'm encountering unexpected behaviour as I download string data from
MySQL using the RODBC package. The unexpected behaviour is that the last
character of the string is truncated. As far as I can see, this happens
when some strings are of length 501 or more.
NOTICE TO RECIPIENTS: Any information contained in or attached to this message is intended solely for the use of the intended recipient(s). If you are not the intended recipient of this transmittal, you are hereby notified that you received this transmittal in error, and we request that you please delete and destroy all copies and attachments in your possession, notify the sender that you have received this communication in error, and note that any review or dissemination of, or the taking of any action in reliance on, this communication is expressly prohibited.
Banc of America Securities LLC ("BAS") does not accept time-sensitive, action-oriented messages or transaction orders, including orders to purchase or sell securities, via e-mail.
Regular internet e-mail transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate, and it should not be relied upon as such. If you prefer to communicate with BAS using secure (i.e., encrypted) e-mail transmission, please notify the sender. Otherwise, you will be deemed to have consented to communicate with BAS via regular internet e-mail transmission. Please note that BAS reserves the right to intercept, monitor, and retain all e-mail messages (including secure e-mail messages) sent to or from its systems as permitted by applicable law.
----------------------------------------------------------------------
IRS Circular 230 Disclosure:
Bank of America Corporation and its affiliates, including BAS, ("Bank of America") do not provide tax advice. Accordingly, any statements contained herein as to tax matters were neither written nor intended by the sender or Bank of America to be used and cannot be used by any taxpayer for the purpose of avoiding tax penalties that may be imposed on such taxpayer. If any person uses or refers to any such tax statement in promoting, marketing or recommending a partnership or other entity, investment plan or arrangement to any taxpayer, then the statement expressed above is being delivered to support the promotion or marketing of the transaction or matter addressed, and the recipient should seek advice based on its particular circumstances from an independent tax advisor.
More information about the R-help
mailing list