How to check DB(SQL Sever Management Studio) is up or down

Hi Team,

How to check DB(Microsoft SQL Sever Management Studio) is up or down.
I want to check whether connection is up or down,then using if condition to run the query if connection is up else come out of loop.

Appreciate your help.

If you are trying to check the database(MS SQL) connection, it is better to connect to the DB directly without using SSMS.


Thank you for your response.
I am directly connecting to DB using Execute Query activity ,but in case if DB is down my bot should come out of loop and should not do further validation.
I want to capture the status and based on that,trigger the email.