Question: If have many `on insert` triggers for a table. Can i specify which trigger will be executed first when i insert values into my table using sqlite?

i thought of combining my triggers but the problem is that i have different `when` statements for each trigger and if i understand the [doc](http://www.sqlite.org/lang_createtrigger.html) correctly the `when` statement commes before my `update`/`insert` etc. statement.

```
CREATE TRIGGER trigger_name AFTER INSERT ON table_name
WHEN expr
BEGIN
    update-stmt;
END;

```

Answer: 
Combine all of the triggers into one:

```
CREATE TRIGGER some_trigger
AFTER INSERT ON some_table
FOR EACH ROW BEGIN
    -- statement 1;
    -- statement 2;
    -- statement 3;
    ...
    -- statement n;
END;

```
If the trigger is to do an update, as in the OP's example, then this won't help. But if each trigger is just checking something and possibly raising an error, which I think is a pretty common case, then it is possible to pack them all into a single trigger procedure (with implicit order of execution) **and** to use different expressions with each:

```
CREATE TRIGGER some_trigger
AFTER INSERT ON some_table
BEGIN
SELECT RAISE(FAIL, "error message one") WHERE (<select-statement-one>) == <value-one>;
SELECT RAISE(FAIL, "error message two") WHERE (<select-statement-two>) == <value-two>;
...
END;

```

(Remember that the value of a subquery expression is the first row of the result from the enclosed SELECT statement.)