我有以下触发器:
CREATE Trigger enroll_limit on Enrollments
Instead of Insert
As
Declare @Count int
Declare @Capacity int
Select @Count = COUNT(*) From Enrollments
Select @Capacity = Capacity From CourseSections
If @Count < @Capacity
Begin
Insert Into Enrollments Select * From Inserted
End
GO
我收到错误信息说:
'CREATE TRIGGER'必须是查询批处理中的第一个语句。