Quantcast
Channel: SQLServerCentral » Programming » SMO/RMO/DMO » Latest topics
Viewing all articles
Browse latest Browse all 99

Idea to simply inform Admin when values are found in SQL-Table by mail, maybe with Notify operator task

$
0
0
Hello,I have found some situations, where values appear in Column NDF_STATUS in database table NDF_AUFTRAG. This can be normal. It is only critical, when these values exceed a limit I_MAXERRORS. I would like to inform the admin of the application, using this table by mail. He is the one who also gets other notifications when e.g. the database backup has failed, so an operator is available.My idea was to check each hour (is enough) if there are more than I_MAXERRORS data rows with criteria:I have a function giving me the test-result:CREATE FUNCTION [dbo].[ERROR_IN_NDF_AUFTRAG] ( ) RETURNS intASBEGINdeclare @I_COUNT_ERRORS as intdeclare @I_MAXERRORS as int=5set @I_COUNT_ERRORS = (select Count (*) from NDF_AUFTRAG where NDF_STATUS between 1 and 9) if @I_COUNT_ERRORS<@I_MAXERRORS begin return 0 end return 1ENDDo you see a simple way to do this?

Viewing all articles
Browse latest Browse all 99

Latest Images

Trending Articles



Latest Images