Welcome to the Microsoft Q&A Platform!
Thank you for reaching out about the issue you’re facing with the Logic App and SQL Server integration. Based on your description, it appears that the discrepancy between the results in the Logic App and directly executing the stored procedure in SSMS may be caused by fewscenarios, including:
- Gateway Configuration: Ensure the on-premises data gateway is up-to-date and running smoothly. Sometimes, restarting the gateway can help resolve any issues caused by caching or network latency.
- Transaction Context: Logic Apps may execute stored procedures in a different transaction context, potentially causing discrepancies. Review your stored procedure for any session-specific settings or temporary tables that might be impacted.
- Network and Timeout Issues: If the stored procedure involves large data sets, network latency or timeouts could cause incomplete or inconsistent results. You may want to adjust the timeout settings in the Logic App connector.
To troubleshoot further, I recommend logging the exact inputs and outputs of the stored procedure in both scenarios and using SQL Profiler to capture the queries executed by the Logic App. Additionally, ensure the gateway's connection to the database is stable and performs as expected.
If this answers your query, do click Accept Answer and Yes for "Was this answer helpful." And, if you have any further query, do let us know.