Home
Up
Feedback
History
About
Tip of the day
Interesting sites
Contact Information
Services
News

Progress messages

Declare an integer for counting iterations and seed it then use the following

select @DispCnt = @DispCnt + 1
if @DispCnt = convert(int,@DispCnt / 100) * 100
select 'Processed ', @DispCnt 

You can also expand by creating another integer to hold the display frequency set to 100 etc or pass it through as a parameter.

e.g. 

Declare @DispCnt int, @DispFrequency int
select @DispCnt = 0, @DispFrequency = 1000
while @@fetch_status = 0
begin
   TSQL Code
    select @DispCnt = @DispCnt + 1
    if @DispCnt = convert(int,@DispCnt / @DispFrequency) * @DispFrequency
        select 'Processed ', @DispCnt 
fetch next from mycur into @var1,@var2...@varn
end

Top

Home ] Up ]

Send mail to Webmaster with questions or comments about this web site.
Copyright © 1999 Svek Computing Limited
Last modified: January 07, 2000