Skip to content

Instantly share code, notes, and snippets.

@pferreirafabricio
Created November 7, 2024 14:15
Show Gist options
  • Save pferreirafabricio/332cc5305a5ba77255857ac446abddab to your computer and use it in GitHub Desktop.
Save pferreirafabricio/332cc5305a5ba77255857ac446abddab to your computer and use it in GitHub Desktop.
🎲 A select query to get queries inside a SQL Server database
SELECT
t.name AS TriggerName,
o.name AS TableName,
t.type_desc AS TriggerType,
m.definition AS TriggerDefinition
FROM
sys.triggers t
INNER JOIN
sys.objects o ON t.parent_id = o.object_id
INNER JOIN
sys.sql_modules m ON t.object_id = m.object_id
WHERE
o.type = 'U'
AND m.definition LIKE '%xyz%'
ORDER BY
o.name, t.name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment