考虑以下存储过程..
CREATE PROCEDURE SlowCleanUp (@MaxDate DATETIME)
AS
BEGIN
PRINT 'Deleting old data Part 1/3...'
DELETE FROM HugeTable1 where SaveDate < @MaxDate
PRINT 'Deleting old data Part 2/3...'
DELETE FROM HugeTable2 where SaveDate < @MaxDate
PRINT 'Deleting old data Part 3/3...'
DELETE FROM HugeTable3 where SaveDate < @MaxDate
PRINT 'Deleting old data COMPLETED.'
END
假设每个删除语句都需要很长时间才能删除,但我喜欢在 SQL Management Studio 中运行此存储过程时查看它的进度。换句话说,我喜欢查看 PRINT 语句的输出,以了解我在任何给定时间的位置。但是,似乎我只能在整个运行结束时看到 PRINT 输出。有没有办法让我可以实时看到 PRINT 输出?如果没有,还有其他方法可以查看正在运行的存储过程的进度吗?