RODBC loses time values of datetime when result set is large

后端 未结 8 1799

So this is VERY strange. RODBC seems to drop the time portion of DateTime SQL columns if the result set is large enough. (The queries are running against an SQL S

8条回答
  •  囚心锁ツ
    2020-12-14 21:58

    This is an older question, but I had similar issues when trying to programmatically read in data from 15 different .accdb. All POSIXct fields were read in correctly for every database except those from the months of March, from which I inferred that it is some sort of daylight-savings time issue.

    The solution for me (because I didn't want to have to make multiple queries to a dB and then rbind() everything together) was to alter my function to include the lines

    #Get initial tz
    current_tz <- Sys.timezone()
    Sys.setenv(TZ = "America/Phoenix")
    
    [BODY OF FUNCTION]
    
    Sys.setenv(TZ = curent_tz)
    

    After including these few lines, the day/time fields from the March databases were being read in correctly.

提交回复
热议问题