I have a procedure that inserts N records and then updates N records. ExecuteNonQuery on that procedure returns 2N. Is there a way to return only number of records updated, i.e. affected in the statement run last?
Thanks.
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.
You could try with SET NOCOUNT OFF/ON inside the stored procedure
You place a SET NOCOUNT ON when the sp starts, thus disabling the count of inserted records, apply the SET NOCOUNT OFF just before the update part of the sp.
Here a reference to MSDN