I'm trying to solve this TestDome quiz: in a company, several different programs insert rows into a messages table which should later be parsed and inserted into appropriate tables. Consider the tables:

Table `messages`

```
  id INTEGER NOT NULL PRIMARY KEY
  type VARCHAR(30) NOT NULL
  data VARCHAR(100) NOT NULL

```

Table `notifications`

```
  id INTEGER NOT NULL PRIMARY KEY
  message VARCHAR(100) NOT NULL

```

Table `alerts`

```
  id INTEGER NOT NULL PRIMARY KEY
  shortMessage VARCHAR(15) NOT NULL

```

Create a procedure called `ParseMessages` in the default schema which should do the following for all rows in the messages table:

* Insert all rows where the type is 'notification' to the `notifications` table with the `message` column being set to the `data` column of `messages` table.
* Insert all rows where the type is 'alert' to the alerts table with the `shortMessage` column being set to the first 15 characters of the `data` column of the `messages` table.

In both cases the `id` column should be the same as in the `messages` column.

You can find the body here: <https://www.testdome.com/questions/60310>

My code is:

```
CREATE PROCEDURE ParseMessages
AS
BEGIN
    BEGIN
        INSERT INTO notifications (id, message)
            SELECT m.id, m.data
            FROM messages m
            WHERE m.type = 'notification' 
              AND m.id NOT IN (SELECT n.id FROM notifications n)
    END;

    BEGIN
        INSERT INTO alerts (id, shortMessage)
            SELECT m.id, SUBSTRING(m.data, 0, 15)
            FROM messages m
            WHERE m.type = 'alert' 
              AND m.id NOT IN (SELECT n.id FROM alerts n)
    END;
END
GO

EXEC ParseMessages

```

But I only get 50%, can you tell why? Thanks in advance!