Need a script to e-mail me a row count

  • Hi All,

    I require a script (or what ever) to e-mail me when a row count on a certain table exceeds a count of say 100,000.

    Any one able to help me. SQL2005 BTW

    Thanks

    Graeme

  • Simply write an after insert trigger for a table, check row count and send mail with sp_send_dbmail procedure.

    http://msdn2.microsoft.com/en-us/library/ms190307.aspx

    However, you shouldn't do it on a high volume table.

  • Another option is to create a custom perfmon counter; SQL Server, User Settable Object

    Then, use that performance counter in an Alert to send the message.

    Additionally, if you ever want to graphically see the row count at any time you can open Perfmon and add that customer counter; SQLServer : User Settable. Or, if you want to watch a trend over time you set up a counter log in perfmon.

  • Thanks heaps guys, all good stuff I will have a play today.:D:hehe:

Viewing 4 posts - 1 through 3 (of 3 total)

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