vb.net - List all triggers in a database -
Is it possible to list all triggers in all the tables on the database? I can list procedures stored by all users with the following:
Private sub archive (Server) Server = Server as new server (Server name) Dim MyDB Dim = theserver.Databases ("mydatabase") Dim dt as DataTable = myDB.EnumObjects (DatabaseObjectTypes.StoredProcedure) End Sub
But nothing is clear in the SMO for the trigger ( I actually only customized the trigger within the selected database, any such name. I am trying to create a list of what is not called DEL_tablename, INS_tablename, UPD_tablename).
Each database object contains a trigger property, which you can repeat to find all triggers Are there.
Once you have a reference to this trigger, check to see IsSystemObject property whether it is user-defined triggers or not.
foreach (Database DDTTrigger oTrigger oDatabase.Triggers) {If (! OTrigger.IsSystemObject) {// do something}}
Have fun Please.
Comments
Post a Comment