There are two ways to delete triggers in sql: 1. Use SSMS database management tool to delete triggers; 2. Use [T-SQL] script to delete triggers, the code is [drop trigger trigger name;].
There are two ways to delete triggers in sql:
1. Delete using SSMS database management tools Trigger
Delete DML trigger
1. Connect to the database, select the database, select the data table-》Expand Data table-"Expand trigger-"Right click-"Select delete.
#2. In the delete object pop-up box - "Click OK -" you can see the deletion result without refreshing.
Delete DDL trigger
1. Connect to the database and select the database-》Expand Programmability -> Expand database triggers -> Right-click -> Select delete.
#2. In the delete object pop-up box - "Click OK -" you can see the deletion result without refreshing.
Delete LOGON trigger
1. Connect to the database-》Expand the server object- 》Expand the trigger-》Right-click-》Select Delete.
#2. In the delete object pop-up box - "Click OK -" you can see the deletion result without refreshing.
##2. Use T-SQL script to delete triggers
Syntax :
--Declare database referenceuse 数据库; go--Determine whether it exists, if it exists, delete it
if exists(select * from sys.triggers where name=触发器名)--Delete DML trigger
drop trigger 触发器名;----Delete DDL trigger
--drop trigger 触发器名 on database;--Delete login trigger
--drop trigger 触发器名 on all server; goExample: This example demonstrates Remove DML update trigger. --Declare database reference
use testss; go--Determine whether it exists, if it exists, delete it
if exists(select * from sys.triggers where name='updatetri') drop trigger updatetri; goExample result:
The above is the detailed content of What are the methods to delete triggers in sql. For more information, please follow other related articles on the PHP Chinese website!