StNickolas
StNickolas

Reputation: 606

SQL Server get progress

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.

Upvotes: 1

Views: 1248

Answers (1)

Richard Ouimet
Richard Ouimet

Reputation: 476

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.

Upvotes: 2

Related Questions