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