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

Progress Messages - logged

Use a permanent work table and just insert into it at various key points.

But beware the gotcha - don't use this to write error messages within transactions - when these are rolled back - so are the logged messages!

create table MySpLog (msgDate datetime, msgContent varchar(255))
go
create procedure MySp (@myvariable int)
begin
declare @msg char(255), @recToDo int
select @recToDo = 0
declare mc cursor for select * from Fred
open mc
insert MySpLog select getdate(), 'Opened the cursor'
select @msg = 'Starting processing'
fetch next from mc into @var1......@varn
while @@fetch_status = 0
begin
    select @recToDo = @recToDo + 1
    select @msg = 'Processing record ' + str(@recToDo)
    insert MySpLog select getdate(), @msg
   fetch next from mc into @var1......@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