I’m running a set of sql queries and they are not reporting the row affect until all the queries have ran. Is there anyway i can get incremental feedback.
Example:
DECLARE @HowManyLastTime int
SET @HowManyLastTime = 1
WHILE @HowManyLastTime <> 2400000
BEGIN
SET @HowManyLastTime = @HowManyLastTime +1
print(@HowManyLastTime)
END
This doesn’t show the count till the loop has finished. How do i make it show the count as it runs?
To flush recordcounts and other data to the client, you’ll want to use RaisError with NOWAIT. Related questions and links:
In SSMS this will work as expected. With other clients, you might not get a response from the client until the query execution is complete.