mysql 如何存储过程返回记录的更新条数
解决方案 »
- 急!Mysql 中按成绩降序排名 取名次(每个人的名次都要有)
- mysql的root密码忘记了肿么办?
- 该下载哪个MySql的版本呀?
- 无法连接mysql问题
- RedHat AS 5 上链接mysql出现问题
- mysql 写存储过程,调试的时候能不能打一些信息
- 如何在命令行中将连接时的字符集设置成utf-8,即实现jdbc:mysql://localhost/<database>?useUnicode=true&characterEncoding=utf-8
- 关于sql的查询 及 书籍推荐 ???
- 想做一个windows下管理apache,php,mysql的东东,给点意见?
- mysql 一个本地数据库和一个远程数据库的事务
- 请给些优化双表关联update的方法
- 普通用户无法启动mysql
搜索 mysql update row affected store procedure
看到 ROW_COUNT() ,再查MySQL 5.1手册 如下,其实问题你自己也可以简单解决。
ROW_COUNT() ROW_COUNT() returns the number of rows updated, inserted, or deleted by the preceding statement. This is the same as the row count that the mysql client displays and the value from the mysql_affected_rows() C API function. mysql> INSERT INTO t VALUES(1),(2),(3);
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0mysql> SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
| 3 |
+-------------+
1 row in set (0.00 sec)mysql> DELETE FROM t WHERE i IN(1,2);
Query OK, 2 rows affected (0.00 sec)mysql> SELECT ROW_COUNT();
+-------------+
| ROW_COUNT() |
+-------------+
| 2 |
+-------------+
1 row in set (0.00 sec)ROW_COUNT()
ROW_COUNT()返回被前面语句升级的、插入的或删除的行数。 这个行数和 mysql 客户端显示的行数及 mysql_affected_rows() C API 函数返回的值相同。
ROW_COUNT() returns the number of rows updated, inserted, or deleted by the preceding statement.
用如下方法可以直接得到影响的行数:
sql="update table1 set field1='good'"
set conn=server.createobject("adodb.connection")
conn.open dsn
conn.execute sql,lngrecs
conn.close:set conn=nothing
response.write lngrecs