我正在尝试在Azure Logic App中调用存储过程。但是,每当我尝试连接到数据库和选择过程或执行应用程序时,都会出现以下错误。
`
{
"status": 400,
"message": "Can not add property StartTime to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object.\r\nclientRequestId: 99825289-bbe8-4b91-8323-075e8cacd09c",
"source": "sql-logic-cp-centralindia.logic-ase-centralindia.p.azurewebsites.net"
}
`
如果尝试执行SQL选择查询而不是存储过程,则会遇到相同的错误。
这是逻辑应用程序的代码。有什么建议么?
`
{
"$connections": {
"value": {
"sql": {
"connectionId": "/subscriptions/XXXX/resourceGroups/Reports/providers/Microsoft.Web/connections/sql",
"connectionName": "sql",
"id": "/subscriptions/XXXX/providers/Microsoft.Web/locations/centralindia/managedApis/sql"
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Execute_stored_procedure": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['sql']['connectionId']"
}
},
"method": "post",
"path": "/datasets/default/procedures/@{encodeURIComponent(encodeURIComponent('[dbo].[SchoolDataDump]'))}"
},
"runAfter": {},
"type": "ApiConnection"
},
"Response": {
"inputs": {
"statusCode": 200
},
"kind": "http",
"runAfter": {
"Execute_stored_procedure": [
"Succeeded"
]
},
"type": "Response"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
}
}
`
答案 0 :(得分:0)
好的,那是一个棘手的错误。经过一番挣扎,我得以弄清楚这个问题。 在我的选择查询中,我有两个名称相同的字段。这导致创建输出JSON时出现问题。
我在查询中有两个字段,如下所示
Select .. SM.StartTime,... SS.StartTime from tables .. joins
SQL输出在SQL输出中具有StartTime的两倍。因此,我添加了一个别名,如下所示,它解决了该问题。
Select .. SM.StartTime,... SS.StartTime as SessionStartTime from tables .. joins