Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server notification when query is done?

Tags:

sql

sql-server

I use SQL Server Management Studio (2008 R2) and I don't have sound/speakers. How can I get a visual notification when a query is done (perhaps a popup notification)? Currently, I have to constantly ping/check to see whether my query is done executing and it's getting tiring.

like image 914
phan Avatar asked Jun 27 '13 14:06

phan


2 Answers

You could always put the query in a SQL Agent job step and get it to email you when it's finished.

like image 90
steoleary Avatar answered Oct 03 '22 14:10

steoleary


I know this question is years old already, but I just ended up here while looking for the same thing. I ended up doing something related to what @david suggested in a comment about writing a program to run the query and send a notification when it was complete.

Using AutoHotkey you can periodically check the title of the SSMS window to see if it includes "Executing..." and pop up a notification when it doesn't.

SetTitleMatchMode, RegEx
DetectHiddenWindows, on
loop {
    WinGetTitle, Title, .*Microsoft SQL Server Management Studio
    If InStr(Title, "Executing...")
        Sleep 60
    Else {
        MsgBox, Done executing "%Title%"
        break
    }
}
like image 20
DavidP Avatar answered Oct 03 '22 12:10

DavidP