我需要更频繁地刷新 SSMS 中的“消息”窗格,有没有办法在没有 GO 语句的情况下实现这一目标?
我的查询是:
DECLARE @Deleted_Rows INT @Deleted_Rows = 1;
DECLARE @Deleted_Rows_Total bigINT = 0;
DECLARE @t1 DATETIME;
DECLARE @t2 DATETIME;
WHILE (@Deleted_Rows > 0)
BEGIN
SET @t1 = GETDATE();
DELETE TOP (100000) FROM PenData WHERE Cas < '20200101'
SET @Deleted_Rows = @@ROWCOUNT;
SET @t2 = GETDATE();
SET @Deleted_Rows_Total = @Deleted_Rows_Total +@Deleted_Rows
PRINT DATEDIFF(SECOND,@t1,@t2)
PRINT @Deleted_Rows_Total
--SELECT @Deleted_Rows AS smazano, @Deleted_Rows_Total AS celkem, DATEDIFF(SECOND,@t1,@t2) AS elapsed_s, GETDATE() as CAS
END