I have this database on SQL Server. When I run the following query:
SELECT * FROM myTable WHERE myDateField <= '2014-12-31'
I get 51618 rows.
But when I run the exact same query from R, using RODBC, I get "<0 rows> (or 0-length row.names)".
Now let's say I change the date:
SELECT * FROM myTable WHERE myDateField <= '2010-01-01'
Then I get the exact same results both on SQL Server directly and on R (!?).
I've found this answer and so I tried adding believeNRows = FALSE
and rows_at_time = 1
to my odbcDriverConnect
statement. But that didn't change anything.
So, what could possibly be going on here? I've been at this for almost 24 hours now and I'm completely out of ideas.
Client: CentOS 7.1.1503, R 3.2.1, RODBC 1.3-12
Server: Windows Server 2012, SQL Server 2014