|
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 |