Well, the first thing you need to do is identify how you will determine whether or not your table has a new row (inserted).
Do you have any date columns on this table? Is one of them a created date for the row? Can you verify that the information in that column is only modified when a new row has been created?
If so, then you could do something like:
If Exists (Select * From MyTable Where datecolumn >= dateadd(minute, -30, getdate()))
Begin;
-- code to send mail here
End;
If you don't have any date columns to identify this - then you might be able to do something with an identity column if you have one on your table. This would involve something like:
Declare @seed int;
Set @seed = (Select seed From LastSeedTable);
If Exists (Select * From MyTable Where identityColumn > @seed)
Begin;
Update LastSeedTable
Set seed = (Select max(identityColumn) From MyTable);
-- code to send email
End;
You can then put the above in a stored procedure and call it from a SQL Agent job - or, just put the code in the Agent job.
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs