How to use the PRINT statement to track execution as stored procedure is running?

前端 未结 3 780
鱼传尺愫
鱼传尺愫 2020-12-30 01:49

Reference: SQL Server

I have a stored procedure with a while loop in it and I want some messages to be printed after every 500 loops.

So, I\'ve

3条回答
  •  执念已碎
    2020-12-30 02:51

    Can I just ask about the long term need for this facility - is it for debuging purposes?

    If so, then you may want to consider using a proper debugger, such as the one found in Visual Studio, as this allows you to step through the procedure in a more controlled way, and avoids having to constantly add/remove PRINT statement from the procedure.

    Just my opinion, but I prefer the debugger approach - for code and databases.

提交回复
热议问题