Skip to content Skip to sidebar Skip to footer

R Getting The Number Of Rows Which Have Been Updated

How can we get the number of rows affected by the executed UPDATE query? r <- sqlQuery(channel, 'UPDATE foo SET bar = 1') What I get (from a connection to a MS SQL Server DB) i

Solution 1:

From the Microsoft Data Access SDK ODBC Help guide:

SQLRowCount returns the number of rows affected by an UPDATE, INSERT, or DELETE statement; an SQL_ADD, SQL_UPDATE_BY_BOOKMARK, or SQL_DELETE_BY_BOOKMARK operation in SQLBulkOperations; or an SQL_UPDATE or SQL_DELETE operation in SQLSetPos.

I expect that there is a way to invoke this ODBC function via the api you are using.

Post a Comment for "R Getting The Number Of Rows Which Have Been Updated"