Add Progress % to SQL Query in C#

I have a SQL query that is going to be returning a large data set from a database table (over a million records), is there a way to create a Progress indicator in C# if I'm using SQL Data Client to execute the queries? I also need to do this same thing for a MERGE (INSERT, UPDATE, DELETE) query that could take some time. Is this possible in a Console App or Windows Forms app?
Michael InmanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
No. Not as long as you don't some kind of batch mode. BUT: which client needs a million rows?
0
Fernando SotoRetiredCommented:
Hi Michael;

Unfortunately there is no way to do this. SQL Server does not report back to the client on the % completed, it only returns a result set after it is done.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Éric MoreauSenior .Net ConsultantCommented:
The best proof that it doesn't exist is that SSMS only shows a timer incrementing time each second instead of a percentage
0
Ryan ChongCommented:
the "SQL query" may need to have more tasks within, so I would think a stored procedure as a solution, in which the whole task may need to be split up into smaller tasks, and another table wil be used to stored the progress.

and then your c# codes wil be used to read that progress table to generate the progress. a background worker or some multi-threaded codes may be needed here.
0
Fernando SotoRetiredCommented:
All post answered the question.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SQL

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.