ORDER placement for trigger in t-sql I'm using Sybase ASE version 16.0.0.1915, (follows t-sql syntax) and trying to create a new trigger. This new trigger emulates another existing trigger, however is slightly modified. It would be a whole lot harder to modify the existing trigger to address both &quot;workflows&quot;, so copying into a new trigger with modified details and an order of &quot;2&quot; would be my preferred solution.
I'm reading in the docs, that in order to create a new trigger based on the same action, I need to set the order for the triggers to fire off. If no order is specified, it is assigned order of 0 (first).
Docs
So here is my trigger, the existing similar trigger does not have an order set. When I place &quot;ORDER 2&quot; into the create statement (after the name, before &quot;on&quot; in row 1), I keep getting syntax error -131.
I've also tried placing the &quot;ORDER 2&quot; after the table name, before &quot;for&quot;, and after &quot;insert&quot;, before &quot;as&quot;. All producing the same error -131.
So what am I doing wrong? Is there some other problem with this trigger preventing me to use the ORDER clause?
create trigger &quot;DBA&quot;.&quot;WKM_autoFillCL143&quot; on
&quot;DBA&quot;.&quot;case_checklist&quot; for insert
as
if((select top 1 &quot;inserted&quot;.&quot;code&quot; from &quot;inserted&quot;) in( '143' ) )
  begin
    declare @parentRef integer,@desc varchar(255),@desc1 varchar(255),@checkID integer
    set @parentRef = (select top 1 &quot;parent_ref&quot; from &quot;inserted&quot;)
    if(@parentRef &lt;&gt; '0')
      begin
        set @desc = (select &quot;description&quot; from &quot;case_checklist&quot; where &quot;checklist_id&quot; = @parentRef)
        if(@desc is not null)
          begin
            set @checkID = (select top 1 &quot;checklist_id&quot; from &quot;inserted&quot;)
            update &quot;WKM_RecordChecklistMapping&quot; set &quot;c143&quot; = @checkID where &quot;c142&quot; = @parentRef
            declare @tabid integer
            set @tabid = (select top 1 &quot;tab_id&quot; from &quot;WKM_recordChecklistMapping&quot; where &quot;c142&quot; = @parentRef)
            set @tabid = (select top 1 &quot;tab_id&quot; from &quot;user_tab2_data&quot; where &quot;tab_id&quot; = @tabid)
            if(@tabid is not null)
              begin
                declare @recProvider varchar(255),@recsRequested varchar(255),@dateFrom &quot;datetime&quot;,@dateTo &quot;datetime&quot;
                set @recProvider = (select top 1 &quot;Provider_Name&quot; from &quot;user_tab2_data&quot; where &quot;tab_id&quot; = @tabid)
                set @recsRequested = (select top 1 &quot;Records_Requested&quot; from &quot;user_tab2_data&quot; where &quot;tab_id&quot; = @tabid)
                set @dateFrom = (select top 1 &quot;For_Dates_From&quot; from &quot;user_tab2_data&quot; where &quot;tab_id&quot; = @tabid)
                set @dateTo = (select top 1 &quot;Through&quot; from &quot;user_tab2_data&quot; where &quot;tab_id&quot; = @tabid)
                set @desc1 = 'Receipt '+@recProvider+' Records? '+@recsRequested+', dates '+&quot;coalesce&quot;(convert(varchar(255),@dateFrom,1),'00/00/00')+' to '+&quot;coalesce&quot;(convert(varchar(255),@dateTo,1),'00/00/00')
                set @checkID = (select top 1 &quot;checklist_id&quot; from &quot;inserted&quot;)
                update &quot;case_checklist&quot; set &quot;description&quot; = @desc1,&quot;staff_assigned&quot; = 'ZKS',&quot;due_date&quot; = (&quot;today&quot;()+7) where &quot;checklist_id&quot; = @checkID
              end
          end
      end
  end
There are 4x different RDBMS products under the Sybase name ... Adaptiver Server Enterprise (ASE), SQLAnywhere, IQ and Advantage.  The 4x products do not share a common SQL language/syntax.
The question references a link for the create trigger syntax in ASE.
The sample code in the question appears to also be for ASE.
However, from the comments we've discovered the OP is actually using the SQLAnywhere product (version 16.0.0.1915).  And while SQLAnywhere does provide some half-workable support for ASE's T-SQL dialect, it does not include a common syntax for the create trigger command.
From the comments: OP has located the documentation for SQLAnyhere's create trigger command.
Using one of the examples from that link (scroll down to find CREATE TRIGGER myTrig), and modifying OP's current trigger code to match the documentation, I'm thinking OP's looking for something like:
create trigger &quot;DBA&quot;.&quot;WKM_autoFillCL143&quot;
after insert order 4 on &quot;DBA&quot;.&quot;case_checklist&quot;
REFERENCING NEW AS inserted
FOR EACH STATEMENT
BEGIN
....

NOTES:

I work primarily on ASE, and my SQLAnywhere experience is rather limited, so OP may need to tweak the above to work correctly in SQLAnywhere; also ...
OP should review the various options available via SQLAnywhere's create trigger command (eg, should the trigger fire before or after the insert?)
OP will need to review the rest of the current (ASE/T-SQL) trigger code to see which parts can be used 'as is' in SQLAnywhere and which parts will need to be rewritten to match SQLAnywhere's syntax
OP will also want to verify SQLAnywhere's support for quoted identifiers (ie, does the current use of double-quoted identifiers meet SQLAnywhere's syntax?)