当前位置: 动力学知识库 > 问答 > 编程问答 >

sql - 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.

网友答案:
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.

网友答案:

The only logical explanation I can come up with is the following. You have an update trigger on your database and it prints out two lines, one with Results and one with a number.

The two rows in parentheses mean that you do have a trigger. One refers to the number of rows affected by the trigger and one to the number affected by the overall statement.

分享给朋友:
您可能感兴趣的文章:
随机阅读: