I wrote an R script a few months ago that uses RODBC to pull data from SQL Server 2008 R2. Last week, I re-ran the script and noticed some inconsistencies.
Upon investigation, it turns out that running the SQL in management studio now returns a divide by zero error, due to some bad data entry. However, when running the same SQL statement through R/RODBC, it returns all rows up to the one which results in a divide by zero error.
I set errors = TRUE on my sqlQuery call, but that had no effect, nor did adding rows_at_time = 1.
Has anyone seen this behavior, or have any ideas as to how to correct it?
mySQLServer <- odbcDriverConnect(connection = "Driver={SQL Server};server=<server-name>;database=<db>;trusted_connection=yes")
sqlResult <- sqlQuery(mySQLServer, <sqlStatement>, errors = TRUE, rows_at_time = 1)