Last active
June 4, 2021 14:45
-
-
Save ghotz/e4612e795717e337ee2781c5ae1cdb45 to your computer and use it in GitHub Desktop.
Various Alerts related
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# quick fix for Copy-DbaAgentAlert not copying categories (and Copy-DbaAgentAlertCategories not existing) | |
param ([string] $Source, $Destination) | |
Get-DbaAgentAlertCategory -SqlInstance $Source | % { New-DbaAgentAlertCategory -SqlInstance $Destination -Category $_.Name}; | |
Copy-DbaAgentAlert -Source $Source -Destination $Destination; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
M1.message_id, M1.severity, M1.[text] | |
, 1 AS is_error_alert, 0 AS is_severity_alert | |
FROM dbo.sysalerts AS A1 | |
JOIN sys.messages AS M1 | |
ON A1.message_id = M1.message_id | |
WHERE M1.language_id = 1033 | |
AND A1.[enabled] = 1 | |
UNION ALL | |
SELECT | |
M1.message_id, M1.severity, M1.[text] | |
, 0 AS is_error_alert, 1 AS is_severity_alert | |
FROM dbo.sysalerts AS A1 | |
JOIN sys.messages AS M1 | |
ON A1.severity = M1.severity | |
WHERE M1.language_id = 1033 | |
AND A1.[enabled] = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment