Writing to a log within a stored procedure.

  • I found a thread pointing to using RAISERROR to produce output from within a stored proc. Here is my dilemma: I want to truncate user tables on a nightly basis. How do I create a log of each table I truncate? I know I can write to a table but I'd prefer to put it to a log. I've tried RAISERROR but cannot find where it puts the information.


    Terry

  • the Log RAISEERROR uses are the Windows Application Log and the SQL Server Error Log!!!!

     


    * Noel

  • I'm using RAISERROR('FYI: This message should be sent without delay', 10, 1) WITH NOWAIT and I cannot find it in the application log, sql server log or the errorlog. What am I doing wrong?? I'm sure it's something real dumb. Thanks.


    Terry

  • RAISERROR('FYI: This message should be sent without delay', 10, 1) WITH NOWAIT,LOG


    * Noel

  • If you don't need to return anything to the client use xp_logevent instead!


    * Noel

  • Even better, write the message to a table in the database. That way you can produce reports on what was done, when and how often.

     

    --------------------
    Colt 45 - the original point and click interface

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply