September 21, 2015 at 1:16 am
I want print state of running query to output, because my query need long time to run.
But print statement dos not work correctly!!
Note: I cannot use "go" in my query!
/* My query */
print 'Fetch Data From Table1 is Running...'
insert into @T1
select x,y,z
from Table1
print 'Fetch Data From Table1 Done.'
print 'Fetch Data From Table2 is Running...'
insert into @T2
select x,y,z
from Table2
print 'Fetch Data From Table2 Done.'
print 'Fetch Data From Table3 is Running...'
insert into @T3
select x,y,z
from Table3
print 'Fetch Data From Table3 Done.'
print 'Fetch Data From Table4 is Running...'
insert into @T4
select x,y,z
from Table4
print 'Fetch Data From Table4 Done.'
print 'Fetch Data From Table5 is Running...'
insert into @T5
select x,y,z
from Table5
print 'Fetch Data From Table5 Done.'
September 21, 2015 at 6:34 am
i assume by you saying "But print statement dos not work correctly!!" you mean they don't print when you want them to, but when the batch completes, right?
you can use raiserror with error zero and featuring with nowait to get a moment in time status instead.
raiserror ('Im at step one in the procedure...so far so good.',0,1) with nowait
Lowell
September 21, 2015 at 7:37 am
Please don't cross-post questions. It just leads to confused conversations. Please use this thread for further comments. It looks like you might be happy with one of the answers on the other thread.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply