Well the good news is that there’s no need to develop anything. SQL Server Management Studio can already do this for you. Simply open SSMS, then click on Tools > Options. In the Options window open Query Results > SQL Server and check the check box next to “Play the Windows default been when a query batch completes” and click OK.
The next time you run a query (you might need to close all your query windows or restart SSMS, you usually do with this sort of change in SSMS) it’ll beep when the query is done.
Personally I’ve actually used this as an alarm clock when doing long running overnight deployments so that I’d get woken up when the script was done so I could start the next step. It’s also handy when you want to leave the room / your desk while queries are running.
Don’t forget to turn up the volume when leaving and turn it back down when you are done.
If you were wondering how long this feature has been in SSMS, I was first using it in Enterprise Manager, in SQL 2000.
Contact the Author | Contact DCAC