Is there any way to return query work progress from SQL Server?
For example I have stored procedure that returns n rows. And I need to know how many time is it lost to finish.
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.
Question:
“Is there any way to return query work progress from SQL Server?
For example I have stored procedure that returns n rows. And I need to know how many time is it lost to finish.”
Answer: Unfortunately, the answer is NO when returning a single query. Within the control flow of transact-SQL or a stored procedure, you may be able to return number of rows processed or returned using the @@rowcount variable or a user defined variable that captures rows affected or returned.
If the transact-sql was using a cursor (not recommended for performance reasons), then you could return a row count after capturing a COUNT of the total number of rows to be processed or returned and then print a counter variable after completion of each loop.