以下のトリガーがあります。
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」は、クエリ バッチの最初のステートメントである必要があります。