SQL-Server: Is there a SQL script that I can use to determine the progress of a SQL Server backup or restore process?

前端 未结 17 1358
独厮守ぢ
独厮守ぢ 2020-12-04 06:16

When I backup or restore a database using MS SQL Server Management Studio, I get a visual indication of how far the process has progressed, and thus how much longer I still

17条回答
  •  日久生厌
    2020-12-04 06:50

    Use STATS in the BACKUP command if it is just a script.

    Inside code it is a bit more complicated. In ODBC for example, you set SQL_ATTR_ASYNC_ENABLE and then look for SQL_STILL_EXECUTING return code, and do some repeated calls of SQLExecDirect until you get a SQL_SUCCESS (or eqiv).

提交回复
热议问题