Link to home
Start Free TrialLog in
Avatar of Alex A
Alex A

asked on

SQL Server: how to print during program execution?

Print output appears in Messages window only after all sprocs execution completes. How to see results during execution, not in the end.
Avatar of prequel_server
prequel_server

Not sure I understand what you mean but I usually use GO after each proc block to execute a batch of script at a time
Avatar of Deepak Chauhan
You can use the "print" keyword like :

declare @min int, @max int , @cmd varchar(20)
set @min =1
set @max=10000000
set @cmd='Current Value is: '
while @min <=@max
begin
print @cmd+cast(@min as varchar)

set @min=@min+1
end
you add print statements whenever required
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Good question.  If it is that important to you, your best bet is to use Jim's solution of inserting into a table and polling it frequently.