List table triggers in SQL Server database - Dataedo

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

Query below lists tables with their triggers. Do you need a fortune teller to tell you about the data you have? If you visited a fortune teller at least once ... SQLServerDataDictionaryQueryToolbox ListtabletriggersinSQLServerdatabase PiotrKononow 25thJune,2018 Articlefor: SQLServer ▾ AzureSQLDatabase Oracledatabase PostgreSQL Querybelowliststableswiththeirtriggers. Query selectschema_name(tab.schema_id)+'.'+tab.nameas[table], trig.nameastrigger_name, casewhenis_instead_of_trigger=1then'Insteadof' else'After'endas[activation], (casewhenobjectproperty(trig.object_id,'ExecIsUpdateTrigger')=1 then'Update'else''end +casewhenobjectproperty(trig.object_id,'ExecIsDeleteTrigger')=1 then'Delete'else''end +casewhenobjectproperty(trig.object_id,'ExecIsInsertTrigger')=1 then'Insert'else''end )as[event], casewhentrig.[type]='TA'then'Assembly(CLR)trigger' whentrig.[type]='TR'then'SQLtrigger' else''endas[type], casewhenis_disabled=1then'Disabled' else'Active'endas[status], object_definition(trig.object_id)as[definition] fromsys.triggerstrig innerjoinsys.objectstab ontrig.parent_id=tab.object_id orderbyschema_name(tab.schema_id)+'.'+tab.name,trig.name; Columns table-nameofthetriggertable(fortabletriggers)withschemaname trigger_name-nameofthetrigger activation-triggeractivationtime:AfterorInsteadof event-specificSQLoperation:Insert,UpdateorDelete type-objecttype: Assembly(CLR)trigger SQLtrigger status-triggerstatus Active Disabled definition-SQLdefinitonoftrigger Rows Onerowrepresentsonetrigger Scopeofrows:allcolumn,tabletriggersinadatabase Orderedbyschemaandtablename Sampleresults 0 Therearenocomments.Clickheretowritethefirstcomment.



請為這篇文章評分?