List triggers in SQL Server database - Dataedo

文章推薦指數: 80 %
投票人數:10人

Query below lists triggers in a database with their details. ... [type] = 'TR' then 'SQL trigger' else '' end as [type], case when is_disabled = 1 then ... SQLServerDataDictionaryQueryToolbox ListtriggersinSQLServerdatabase PiotrKononow 25thJune,2018 Articlefor: SQLServer ▾ AzureSQLDatabase Oracledatabase IBMDb2 Teradata MySQL MariaDB Querybelowliststriggersinadatabasewiththeirdetails. Query selecttrg.nameastrigger_name, schema_name(tab.schema_id)+'.'+tab.nameas[table], casewhenis_instead_of_trigger=1then'Insteadof' else'After'endas[activation], (casewhenobjectproperty(trg.object_id,'ExecIsUpdateTrigger')=1 then'Update'else''end +casewhenobjectproperty(trg.object_id,'ExecIsDeleteTrigger')=1 then'Delete'else''end +casewhenobjectproperty(trg.object_id,'ExecIsInsertTrigger')=1 then'Insert'else''end )as[event], casewhentrg.parent_class=1then'Tabletrigger' whentrg.parent_class=0then'Databasetrigger' end[class], casewhentrg.[type]='TA'then'Assembly(CLR)trigger' whentrg.[type]='TR'then'SQLtrigger' else''endas[type], casewhenis_disabled=1then'Disabled' else'Active'endas[status], object_definition(trg.object_id)as[definition] fromsys.triggerstrg leftjoinsys.objectstab ontrg.parent_id=tab.object_id orderbytrg.name; Columns trigger_name-nameofthetrigger table-nameofthetriggertable(fortabletriggers)withschemaname activation-triggeractivationtime:AfterorInsteadof event-specificSQLoperation:Insert,UpdateorDelete class-triggerclass: Databasetrigger-fortheDDLtriggers Tabletrigger-forobjectorcolumnfortheDMLtriggers type-objecttype: Assembly(CLR)trigger SQLtrigger status-triggerstatus Active Disabled definition-SQLdefinitonoftrigger Rows Onerowrepresentsonetrigger Scopeofrows:allcolumn,tableanddatabase(DDL)triggersinadatabase Orderedbytriggername Sampleresults 0 Therearenocomments.Clickheretowritethefirstcomment.



請為這篇文章評分?