I am running SP which does not return any rows or data , than in that case which is more efficient
executeScalar() or executeNonQuery()
I am running SP which does not return any rows or data , than
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you don’t want to read a value you should use executeNonQuery. It has nothing to do with efficiency. You should do it because that’s the correct way to do it. Using executeScalar here is just wrong.
It’s probably also faster, but that’s not the point. If you are firing so many queries that this minor performance detail makes a difference something is wrong with your query.