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 int
AS
BEGIN
declare @I_COUNT_ERRORS as int
declare @I_MAXERRORS as int=5
set @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 1
END
Do you see a simple way to do this?