[R] RODBC to MS SQL Server update error

Bond, Stephen Stephen.Bond at cibc.com
Wed Nov 7 15:37:06 CET 2012


Is this a bug:

Trying to update when the where condition gives zero rows throws an error on MS SQL server

> sqlQuery(pipe,"select * from ComDetailCurrent where RateTypeId is null;")
 [1] ProcessDate       SourceSystemId    AccountNumber     Xref1             
<0 rows> (or 0-length row.names)

sqlQuery(pipe,"update ComDetailCurrent set RateTypeId=1 where RateTypeId is null;")
[1] "[RODBC] ERROR: Could not SQLExecDirect 'update ComDetailCurrent set RateTypeId=1 where RateTypeId is null;'"

On the other hand with MySQL
> sqlQuery(mys,"update rate_hist set val=5.0 where dtend<'1986-05-01'")
[1] "No Data"

Please, try to update a table on SQL server and give it a where condition such that zero rows will be updated. And post the result on this forum :-)
Thanks everybody and have a great day.

Stephen B



More information about the R-help mailing list