CREATE TRIGGER must be the first statement in a batch

前端 未结 2 2227
别跟我提以往
别跟我提以往 2021-02-18 13:41

I have the below trigger:

 CREATE Trigger enroll_limit on Enrollments
 Instead of Insert
 As
 Declare @Count int
 Declare @Capacity int
 Select @Count = COUNT(*)         


        
2条回答
  •  温柔的废话
    2021-02-18 13:56

    The error message "'CREATE TRIGGER' must be the first statement in a query batch." usually occurs when a preceding group (batch) of statements does not have a terminating GO

    So, I would suggest adding add a GO to the end of the preceding batch's statements.

提交回复
热议问题