R获取已更新的行数 [英] R Getting the number of rows which have been updated
问题描述
如何获得受执行的UPDATE查询影响的行数?
How can we get the number of rows affected by the executed UPDATE query?
r <- sqlQuery(channel, 'UPDATE foo SET bar = 1')
我得到的(从连接到MS SQL Server DB)只是一个character(0)
...
What I get (from a connection to a MS SQL Server DB) is just a character(0)
...
推荐答案
来自Microsoft数据访问SDK ODBC帮助指南:
From the Microsoft Data Access SDK ODBC Help guide:
SQLRowCount返回受UPDATE,INSERT或DELETE语句影响的行数; SQLBulkOperations中的SQL_ADD,SQL_UPDATE_BY_BOOKMARK或SQL_DELETE_BY_BOOKMARK操作;或SQLSetPos中的SQL_UPDATE或SQL_DELETE操作.
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.
我希望有一种方法可以通过您使用的api来调用此ODBC函数.
I expect that there is a way to invoke this ODBC function via the api you are using.
这篇关于R获取已更新的行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!