Domanda

Accedo a un DB commerciale. Tramite prompt:

 select PersonCode, PersonDate from CODB.mastertable where PersonCode=42
 PersonCode  PersonDate 
 ----------- ------------
       42 Jan  3 2011
       42 Jan  3 2011
       42 Jan  3 2011
       42 Jan  3 2011
       42 Jan  3 2011
       42 Jan  3 2011
       42 Jan  3 2011
       42 Jan  3 2011
       42 Jan  3 2011
       42 Jan  3 2011

In r:

library(RODBC)
query <- "select PersonCode, PersonDate from CODB.mastertable where PersonCode=42"

connection1 <- odbcConnect("RESDB", uid="userID", pwd="pwdaccess", believeNRows=FALSE)

sqlQuery(connection1,query)


sqlQuery(connection1,query)
    PersonCode                 PersonDate 
1          42 01/03/2011 00:00:00.000 UTC
2          42 01/03/2011 00:00:00.000 UTC
3          42 01/03/2011 00:00:00.000 UTC
4          42 01/03/2011 00:00:00.000 UTC
5          42 01/03/2011 00:00:00.000 UTC
6           0 01/03/2011 00:00:00.000 UTC
7           0 01/03/2011 00:00:00.000 UTC
8           0 01/03/2011 00:00:00.000 UTC
9           0 01/03/2011 00:00:00.000 UTC
10          0 01/03/2011 00:00:00.000 UTC

L'output della query non è corretta. qualcuno ha mai riscontrato questo problema prima? Qui alcune informazioni aggiuntive.

> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] timeDate_2130.92 data.table_1.5.3 RODBC_1.3-2

loaded via a namespace (and not attached):
[1] tools_2.12.1

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top