# Send email if SQL server is fauled?

**URL:** <https://forum.inductiveautomation.com/t/send-email-if-sql-server-is-fauled/8131>\
**Category:** Ignition\
**Created:** [March 10, 2014, 7:41pm UTC](https://forum.inductiveautomation.com/t/send-email-if-sql-server-is-fauled/8131 "2014-03-10T19:41:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SonicClang](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@SonicClang](https://forum.inductiveautomation.com/u/SonicClang)\
**Post date:** [March 10, 2014, 7:41pm UTC](https://forum.inductiveautomation.com/t/send-email-if-sql-server-is-fauled/8131/1 "2014-03-10T19:41:29Z")

</div>

I just had a situation where the SQL server was down all weekend and most of today and no one noticed. Is there a way to set up an email to be sent if the connection is faulted?

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [March 10, 2014, 8:19pm UTC](https://forum.inductiveautomation.com/t/send-email-if-sql-server-is-fauled/8131/2 "2014-03-10T20:19:10Z")

</div>

You can create an expression to query the database, using the try option and you can set your alarm on the failback value. Here, if the SQLTag Expression equals -999, there is a problem.

```auto
try(executeScalarQuery("SELECT testlong FROM test","LocalDB"),-999)
```

---

<div class="post-metadata">

**Author:** ![SonicClang](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@SonicClang](https://forum.inductiveautomation.com/u/SonicClang)\
**Post date:** [March 10, 2014, 9:03pm UTC](https://forum.inductiveautomation.com/t/send-email-if-sql-server-is-fauled/8131/3 "2014-03-10T21:03:50Z")

</div>

I think that’ll work! I have the expression tag set up, it’s giving me correct information, now I just need to learn how to finally set up alarming with a notification. Thank you!
