Brian_K Brian_K - 1 month ago 5
SQL Question

On an update statement, what does result = 1 mean?

Running an update, comes back with

Results
1


Messages

(1 row affected)
(0 rows affected)


What does the Result = 1 mean? In all other dbs I run this in, I get a zero, and I thought that was a return code. I checked @@error and it's 0. Searched with no joy.

Answer
Results
  1   

is the result set

(1 row affected)
(0 rows affected)

is the number of rows affected by current statement/s

It is not possible for your update to return result set ,unless you are using output clause

As AdaTheDev points out,you might be having a trigger which can cause below behaviour

run this in multiple dbs, only one has records that match the criteria. In five dbs, four give me results = 0 and one gives me results = 1 but all say they affected one row.

Comments