7> CREATE TABLE dbo.MyTable
8> (TestID int NOT NULL)
9> GO
1>
2> CREATE TRIGGER dbo.trg_i_MyTable
3> ON dbo.MyTable
4> AFTER INSERT
5> AS
6> PRINT 'I will be fired first.'
7> GO
1>
2> CREATE TRIGGER dbo.trg_i_MyTable2
3> ON dbo.MyTable
4> AFTER INSERT
5> AS
6> PRINT 'I will be fired last.'
7> GO
1>
2> CREATE TRIGGER dbo.trg_i_MyTable3
3> ON dbo.MyTable
4> AFTER INSERT
5> AS
6> PRINT '3'
7> GO
1>
2> CREATE TRIGGER dbo.trg_i_MyTable3
3> ON dbo.MyTable
4> AFTER INSERT
5> AS
6> PRINT 'I 3'
7> GO
1>
2> EXEC sp_settriggerorder 'trg_i_MyTable', 'First', 'INSERT'
3> EXEC sp_settriggerorder 'trg_i_MyTable2', 'Last', 'INSERT'
4>
5> INSERT dbo.MyTable
6> (TestID)
7> VALUES (1)
8>
9> drop table dbo.MyTable
10> GO
(1 rows affected)
I will be fired first.
3
I will be fired last.
1>
2>