开发者

SQL Return code from Select count(*)

开发者 https://www.devze.com 2023-02-28 22:56 出处:网络
What is the return code from SQL if you execute a SELECT COUNT(*) from ... and a count of 0 is returned? Is it 0 or 100开发者_开发技巧 (not found)?

What is the return code from SQL if you execute a SELECT COUNT(*) from ... and a count of 0 is returned? Is it 0 or 100开发者_开发技巧 (not found)?

Thank you.


It will always return 1 row with 1 column (containing the number of rows i.e. the count(*) value), if that is what you are asking....


Assuming you are talking about MS SQL Server, the @@error code will always be 0 assuming you query a valid table. The @@error code is describing the success of the action itself, not the success of the results.


Zero because there were no rows. What would 100 have to do with it?

Please look at my answer here too: Does COUNT(*) always return a result?

Edit: unless you mean DB2 as noted elsewhere...

0

精彩评论

暂无评论...
验证码 换一张
取 消