Questions tagged [rows-affected]

The number of rows affected by executing a SQL Query

The number of rows affected by executing a SQL Query.

The @@ROWCOUNT variable will return the number of rows affected by the last executed query in SQL Server

65 questions
0
votes
1 answer

php mysql affected_rows showing 2

I am having a bit of trouble. This was working until I added a second database class to run some test methods. After removing this I am now getting this error and can't understand why. Warning: extract() expects parameter 1 to be array, null given…
Thomas Hughes
  • 99
  • 1
  • 11
0
votes
1 answer

PHPMyAdmin CSV LOAD DATA affected rows not showing

We are using PHPMyAdmin to do partial CSV imports (this is important as the lack of matching every column means we have to do CSV with LOAD DATA vs CSV import) We try to keep up with the latest versions of PHP 5.6.22, PHPMyAdmin (on 4.6.3 now) and…
0
votes
1 answer

The number of changed rows (rows affected) is always 1 with SQLite (Android)

I have this SQLite table in my Android application: CREATE TABLE " + TABLE_NAME + " (" + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT" + COMMA + COLUMN_NAME_SID + " INTEGER" + COMMA + COLUMN_NAME_TITLE + " TEXT NOT NULL" + …
Alex
  • 163
  • 11
0
votes
4 answers

How to get records affected by an update stored procedure in LINQ to SQL

I'm executing an update stored procedure from LINQ to SQL and I need to know the records affected after the update is called. I'm using dbml designer to generate the LINQ code.
IsmailS
  • 10,797
  • 21
  • 82
  • 134
0
votes
0 answers

affected_rows may return 0, 1, -1, 3 or in some scenarios NULL [Suggested Answer]

The PHP documentation contains the reasons why an affected_rows statement might return 0, 1, -1 or even 3 in some scenarios, as does the answer to this particular stack question. PHP / MySQLI: strange readings for affected_rows But the wall I hit…
0
votes
1 answer

Get detailed number of Rows affected by insert statement

My table is setup with one of the columns named 'Month". I run a sql insert statement on the table, and get the number of rows affected. Is there a way to get the number of rows affected for each value of "Month"? If my table is partition on the…
daniely
  • 7,313
  • 5
  • 29
  • 46
0
votes
1 answer

How to get number of affected_rows in mysqli OOP? Mysqli OOP affected_rows returning -1

What is the exect way to get number of affected rows in mysqli OOP. I am creating crud class using msqli OOP. I am getting int -1. $query = "SELECT * FROM `sk_courses`"; $stmt = $this->_mysqli->prepare($query); $stmt->execute(); …
Zohaib
  • 328
  • 1
  • 3
  • 15
0
votes
2 answers

Determine if SQL UPDATE affected individual JOINed tables

According to http://us3.php.net/manual/en/pdostatement.rowcount.php: PDOStatement::rowCount() returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding PDOStatement object. Using a…
user1032531
  • 24,767
  • 68
  • 217
  • 387
0
votes
0 answers

MySQL update returns 0 rows affected in transaction

Table account have special field 'executor' for daemons to know that account is blocked for update with one of daemons. Step by step: start transaction block account with: UPDATE `account` SET `executor` = 2727 WHERE `executor` is NULL AND `id` =…
Magvaj
  • 1
  • 2
0
votes
1 answer

Getting the affected rows when altering a table in mysql

I need to retrieve a report of the affected rows when a table has been altered with the following commands: 1.- Changing the engine: ALTER TABLE ENGINE=INNODB; 2.- Adding constraints: ALTER TABLE nombre_tabla ADD PRIMARY KEY…
richardtk_1
  • 751
  • 3
  • 11
  • 33
0
votes
0 answers

Bug? "SELECT LEFT JOIN" match all rows, but "UPDATE LEFT JOIN" ignores some. Example inside

I want to update two tables with one UPDATE query. I use a simple LEFT JOIN for that. Curiously not all matching rows are changed. This are the example tables: DROP TABLE IF EXISTS `test_continents`, `test_agents`; CREATE TABLE IF NOT EXISTS…
m4dm4x1337
  • 1,847
  • 2
  • 11
  • 3
0
votes
4 answers

Active Records - Affected Rows always returning 1

I am trying to make a change password code using the active records. That works fine but I need to know whether the password was successfully changed or that the current password was actually wrong. I am using affected rows to see how many records…
XuryaX
  • 41
  • 1
  • 7
0
votes
1 answer

MYSQL UPDATE using LEFT JOIN

Question; In the below MySQL query the inner query which produces the list of ConnectionIDs returns 34 ConnectionIDs. When I then run the two queries together as an update the query result indicated that only 14 rows were affected. Is my…
David.LPower
  • 1,083
  • 2
  • 10
  • 14
0
votes
1 answer

MySQL Procedure returning 1 affected row, when it didn't update anything

I have the following stored procedure in my mysql database: BEGIN DECLARE useCount, remainingUses INT DEFAULT 0; /* Get the current values for the quiz into the variables */ SELECT remaining_uses, use_count INTO remainingUses, useCount FROM…
Luke
  • 22,826
  • 31
  • 110
  • 193
0
votes
6 answers

Affected_rows always returning false on delete

I checked around to see what exactly affected_rows returns. It's supposed to return > 0 if something was deleted, and 0 if nothing was, correct? But when I delete a product, it is deleted because it exists via the product id. But when I want to test…
a7omiton
  • 1,597
  • 4
  • 34
  • 61