SQL Return code from Select count(*)

末鹿安然 提交于 2019-12-11 07:42:15

问题


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.


回答1:


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




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/5809551/sql-return-code-from-select-count

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!