Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
egemen_ates
Yak Posting Veteran
76 Posts |
Posted - 2014-04-24 : 11:13:46
|
Hello myfriends,I want to create alert for query recordcount,I will explain with exampleOne user execute query,query return 2000 000 rows ,I want to send mailfor query recordcount greater than 1000 000 how can i do its possible thank you, |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2014-04-24 : 17:09:09
|
If your users are selecting directly against a table, I know of no way to generate such a message. If they are accessing the data through a stored procedure, after the select statement, examine the @@rowcount variable, and if that is more than your specified count, use sp_send_dbmail to send the e-mail.http://technet.microsoft.com/en-us/library/ms190307.aspx....YourSelectStatement inthe stored proc hereif (@@rowcount > 1000000)begin exec sp_send_dbmail ....end |
|
|
egemen_ates
Yak Posting Veteran
76 Posts |
Posted - 2014-04-25 : 07:42:38
|
Thank You James,But I dont this because my system has alot of query,This way very hard for me ,How can i do another way ?quote: Originally posted by James K If your users are selecting directly against a table, I know of no way to generate such a message. If they are accessing the data through a stored procedure, after the select statement, examine the @@rowcount variable, and if that is more than your specified count, use sp_send_dbmail to send the e-mail.http://technet.microsoft.com/en-us/library/ms190307.aspx....YourSelectStatement inthe stored proc hereif (@@rowcount > 1000000)begin exec sp_send_dbmail ....end
|
|
|
egemen_ates
Yak Posting Veteran
76 Posts |
|
|
|
|
|
|