0
votes

My SQL Server seems to be connected correctly because database and table name is suggested in logic app.

enter image description here

However, the logic app trigger history all skipped.

Output log is here:

{
    "statusCode": 202,
    "headers": {
        "Pragma": "no-cache",
        "Retry-After": "15",
        "x-ms-request-id": "7d7786b9-b7db-4958-a1ef-7c651a31f3a0",
        "OData-Version": "4.0",
        "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
        "X-Content-Type-Options": "nosniff",
        "X-Frame-Options": "DENY",
        "Timing-Allow-Origin": "*",
        "x-ms-apihub-cached-response": "true",
        "Cache-Control": "no-store, no-cache",
        "Date": "Thu, 06 Feb 2020 09:31:01 GMT",
        "Location": "https://logic-apis-eastus.azure-apim.net/apim/sql/7835fbfdd13e4975ab4d9adbf41059e2/v2/datasets/default,default/tables/%255Bdbo%255D.%255Btransactions%255D/onnewitems?triggerstate=",
        "Content-Length": "113",
        "Content-Type": "application/json; odata.metadata=minimal; odata.streaming=true",
        "Expires": "-1"
    },
    "body": {
        "@odata.context": "https://sql-eus.azconn-eus.p.azurewebsites.net/v2/$metadata#items",
        "value": []
    }
}

I use query editor to simulate when '項目が作成された時' by this query

INSERT INTO transactions (txFrom, txTo)
VALUES ('a', 'b')

The INSERT succeeds, so I expect "when item is created trigger" should be run, but nothing happens.

What is my problem?

1

1 Answers

0
votes

The problem was Azure SQL.

Azure SQL table should have primary ID to trigger logic up.

I changed table definition from

CREATE TABLE transactions
(
    txFrom TEXT,
    txTo TEXT
);

to

CREATE TABLE transactions
(
    id int NOT NULL IDENTITY(1,1) PRIMARY KEY,
    txFrom TEXT,
    txTo TEXT
);

this solved the problem.