Task #1. I want to write notification to log if my SQL server is not available.
Solution:
- Create an event definition with a connection to required server and database.
- Specify SQL statement that will be executed successfully while the server is available. For example: select 1;
- Select interval between checks (10 minutes, for example) and "Infinite" execution type.
- Select "SQL statement executed failed" as a condition.
- Use "Write to log" option as an action. Enter something like "My server is down".
During execution, the program will write entered message with date and time to ERROR.LOG file when specified
server could not execute SQL statement.
Task #2. I've two databases Test1 and "AllData". I want to execute my stored procedure CheckT1 in Test1
once per hour and only when number of rows in table T1 in "AllData" greater than 12.
Solution:
- Create an event definition with a connection to required server and "AllData" database.
- create SQL statement for event definition: "select count(*) from T1"
- Specify 1 hour as interval between checks.
- For condition, you should use "Result > 12"
- At the action page select "Execute SQL" and specify the connection to "Test1" database.
- Enter "call CheckT1" as SQL statement for action.
Task #3. I want to add a new row five times per hour to my SQL Server table.
Solution:
- Create an event definition with a connection to required server and database.
- Specify required INSERT statement at event definition tab.
- Select 20 minutes as the interval between checks.
- Use "Unconditional" and "No action" at related tabs.