https://www.cnblogs.com/FlyGoldfish/articles/6398212.html
# def starttrigger():# enable 启动 # disable 关闭 conn, cursor=get57sql() starttrigger_sql="alter table [PersonHouseInfo].[dbo].[student2] enable trigger trig_delete" cursor.execute(starttrigger_sql) conn.commit() # 创建触发器 def createtrigger(): conn, cursor = get57sql() createtrigger_sql="Create trigger [dbo].[trig_delete] on [dbo].[student2] after delete as begin select stu_id as 已删除的学生编号,stu_name, stu_gender, stu_age from deleted end;" cursor.execute(createtrigger_sql) conn.commit() # 删除触发器 def droptrigger(): conn, cursor = get57sql() droptrigger_sql="drop trigger trig_delete" cursor.execute(droptrigger_sql) conn.commit()