Search code examples
sql-serverdelphidelphi-11-alexandria

Getting progress of stored procedure


I have a long running stored procedure, executed in a thread (via TADOStoredProc) to ensure that the application remains responsive.

There are a number of RAISERROR() WITH NOWAIT statements in the stored procedure so I can monitor progress while running it in SSMS.

Is there any way that the application can get these messages so that I can give the users some indication of progress?


Solution

  • Messages (e.g. PRINT and RAISERROR) may be captured by handling the ADODB.Connection.InfoMessage event in ADO classic. This is exposed by the Data.Win.ADODB.TADOConnection.OnInfoMessage event.