Home
Up
About
Performance
Certifications
SVEK News Page
Tip of the day
Summary of Skills
SQL Server Tips
Some interesting sites
Interesting sites
Guest Book
Contact Information
Software Development
Services
CompanyHistory

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 Ltd
Last modified: January 27, 2003