A simple threshold procedure

Following is a simple procedure that dumps the transaction log and prints a message to the error log. Because this procedure uses a variable (@dbname) for the database name, it can be used for all databases in Adaptive Server:

create procedure sp_thresholdaction
    @dbname varchar(30),
    @segmentname varchar(30),
    @free_space int,
    @status int
as
dump transaction @dbname
    to tapedump1
print "LOG DUMP: ’%1!’ for ’%2!’ dumped",
        @segmentname, @dbname